From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: <dev@dpdk.org>
Subject: Re: [PATCH] net/pcap: fix indentation and numa node
Date: Mon, 7 Apr 2025 10:51:37 +0100 [thread overview]
Message-ID: <Z_OgKaEXuxqWALbm@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20250405153623.200771-1-stephen@networkplumber.org>
On Sat, Apr 05, 2025 at 08:36:23AM -0700, Stephen Hemminger wrote:
> The process private data allocation was indented incorrectly
> in the source code, and had unnecessary cast. It is better
> that the data be allocated on same numa node as the device
> structure.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> drivers/net/pcap/pcap_ethdev.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
> index 728ef85d53..aefa74c7be 100644
> --- a/drivers/net/pcap/pcap_ethdev.c
> +++ b/drivers/net/pcap/pcap_ethdev.c
> @@ -1208,10 +1208,8 @@ pmd_init_internals(struct rte_vdev_device *vdev,
> PMD_LOG(INFO, "Creating pcap-backed ethdev on numa socket %d",
> numa_node);
>
> - pp = (struct pmd_process_private *)
> - rte_zmalloc(NULL, sizeof(struct pmd_process_private),
> - RTE_CACHE_LINE_SIZE);
> -
> + pp = rte_zmalloc_socket(NULL, sizeof(struct pmd_process_private),
> + RTE_CACHE_LINE_SIZE, numa_node);
> if (pp == NULL) {
> PMD_LOG(ERR,
> "Failed to allocate memory for process private");
My concern there is that by forcing the numa node parameter, you are going
to make it impossible to run with memory on the "wrong" numa node.
Admittedly, this is less of a problem with virtual devices like pcap, than
physical ones, but I still wonder if, on error, you should fallback to a
regular "rte_malloc" call to allow the allocation to succeed so long as
there is some hugepage memory available somewhere.
/Bruce
next prev parent reply other threads:[~2025-04-07 9:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-05 15:36 Stephen Hemminger
2025-04-07 9:51 ` Bruce Richardson [this message]
2025-04-07 15:08 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_OgKaEXuxqWALbm@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).