From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>,
Alexander Duyck <alexanderduyck@fb.com>,
Yunsheng Lin <linyunsheng@huawei.com>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Christoph Lameter <cl@linux.com>,
Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
nex.sw.ncis.osdt.itp.upstreaming@intel.com,
netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next v10 04/10] slab: introduce kvmalloc_array_node() and kvcalloc_node()
Date: Thu, 18 Apr 2024 13:36:10 +0200 [thread overview]
Message-ID: <20240418113616.1108566-5-aleksander.lobakin@intel.com> (raw)
In-Reply-To: <20240418113616.1108566-1-aleksander.lobakin@intel.com>
Add NUMA-aware counterparts for kvmalloc_array() and kvcalloc() to be
able to flexibly allocate arrays for a particular node.
Rewrite kvmalloc_array() to kvmalloc_array_node(NUMA_NO_NODE) call.
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
---
include/linux/slab.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index e53cbfa18325..d1d1fa5e7983 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -774,14 +774,27 @@ static inline __alloc_size(1) void *kvzalloc(size_t size, gfp_t flags)
return kvmalloc(size, flags | __GFP_ZERO);
}
-static inline __alloc_size(1, 2) void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
+static inline __alloc_size(1, 2) void *
+kvmalloc_array_node(size_t n, size_t size, gfp_t flags, int node)
{
size_t bytes;
if (unlikely(check_mul_overflow(n, size, &bytes)))
return NULL;
- return kvmalloc(bytes, flags);
+ return kvmalloc_node(bytes, flags, node);
+}
+
+static inline __alloc_size(1, 2) void *
+kvmalloc_array(size_t n, size_t size, gfp_t flags)
+{
+ return kvmalloc_array_node(n, size, flags, NUMA_NO_NODE);
+}
+
+static inline __alloc_size(1, 2) void *
+kvcalloc_node(size_t n, size_t size, gfp_t flags, int node)
+{
+ return kvmalloc_array_node(n, size, flags | __GFP_ZERO, node);
}
static inline __alloc_size(1, 2) void *kvcalloc(size_t n, size_t size, gfp_t flags)
--
2.44.0
next prev parent reply other threads:[~2024-04-18 11:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 11:36 [PATCH net-next v10 00/10] net: intel: start The Great Code Dedup + Page Pool for iavf Alexander Lobakin
2024-04-18 11:36 ` [PATCH net-next v10 01/10] net: intel: introduce {,Intel} Ethernet common library Alexander Lobakin
2024-04-18 11:36 ` [PATCH net-next v10 02/10] iavf: kill "legacy-rx" for good Alexander Lobakin
2024-04-18 11:36 ` [PATCH net-next v10 03/10] iavf: drop page splitting and recycling Alexander Lobakin
2024-04-18 11:36 ` Alexander Lobakin [this message]
2024-04-18 11:36 ` [PATCH net-next v10 05/10] page_pool: constify some read-only function arguments Alexander Lobakin
2024-04-18 11:36 ` [PATCH net-next v10 06/10] page_pool: add DMA-sync-for-CPU inline helper Alexander Lobakin
2024-04-18 14:56 ` Ilias Apalodimas
2024-04-18 11:36 ` [PATCH net-next v10 07/10] libeth: add Rx buffer management Alexander Lobakin
2024-04-18 11:36 ` [PATCH net-next v10 08/10] iavf: pack iavf_ring more efficiently Alexander Lobakin
2024-04-18 11:36 ` [PATCH net-next v10 09/10] iavf: switch to Page Pool Alexander Lobakin
2024-04-18 11:36 ` [PATCH net-next v10 10/10] MAINTAINERS: add entry for libeth and libie Alexander Lobakin
2024-04-18 14:29 ` [PATCH net-next v10 00/10] net: intel: start The Great Code Dedup + Page Pool for iavf Przemek Kitszel
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=20240418113616.1108566-5-aleksander.lobakin@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=akpm@linux-foundation.org \
--cc=alexanderduyck@fb.com \
--cc=cl@linux.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linyunsheng@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=nex.sw.ncis.osdt.itp.upstreaming@intel.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=vbabka@suse.cz \
/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