linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Alexander Lobakin <aleksander.lobakin@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: 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>,
	Andrew Morton <akpm@linux-foundation.org>,
	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,
	Suren Baghdasaryan <surenb@google.com>,
	Kent Overstreet <kent.overstreet@linux.dev>
Subject: Re: [PATCH net-next v9 4/9] slab: introduce kvmalloc_array_node() and kvcalloc_node()
Date: Fri, 5 Apr 2024 12:44:22 +0200	[thread overview]
Message-ID: <e62d9465-7056-4714-9a4e-4645a457774e@suse.cz> (raw)
In-Reply-To: <20240404154402.3581254-5-aleksander.lobakin@intel.com>

On 4/4/24 5:43 PM, Alexander Lobakin wrote:
> 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.
> 
> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>

Acked-by: Vlastimil Babka <vbabka@suse>

This will however cause some conflicts with alloc tagging series with mm
tree in next and the new wrappers will have to be adjusted.

> ---
>  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)



  parent reply	other threads:[~2024-04-05 10:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 15:43 [PATCH net-next v9 0/9] net: intel: start The Great Code Dedup + Page Pool for iavf Alexander Lobakin
2024-04-04 15:43 ` [PATCH net-next v9 1/9] net: intel: introduce {,Intel} Ethernet common library Alexander Lobakin
2024-04-04 15:43 ` [PATCH net-next v9 2/9] iavf: kill "legacy-rx" for good Alexander Lobakin
2024-04-05 10:15   ` Przemek Kitszel
2024-04-04 15:43 ` [PATCH net-next v9 3/9] iavf: drop page splitting and recycling Alexander Lobakin
2024-04-04 15:43 ` [PATCH net-next v9 4/9] slab: introduce kvmalloc_array_node() and kvcalloc_node() Alexander Lobakin
2024-04-05 10:12   ` Przemek Kitszel
2024-04-05 10:44   ` Vlastimil Babka [this message]
2024-04-04 15:43 ` [PATCH net-next v9 5/9] page_pool: constify some read-only function arguments Alexander Lobakin
2024-04-04 15:43 ` [PATCH net-next v9 6/9] page_pool: add DMA-sync-for-CPU inline helper Alexander Lobakin
2024-04-04 15:44 ` [PATCH net-next v9 7/9] libeth: add Rx buffer management Alexander Lobakin
2024-04-05 10:32   ` Przemek Kitszel
2024-04-08  9:09     ` Alexander Lobakin
2024-04-09 10:58       ` Przemek Kitszel
2024-04-10 11:49         ` Alexander Lobakin
2024-04-10 13:01           ` Przemek Kitszel
2024-04-10 13:01             ` Alexander Lobakin
2024-04-10 13:12               ` Przemek Kitszel
2024-04-06  4:25   ` Jakub Kicinski
2024-04-08  9:11     ` Alexander Lobakin
2024-04-08  9:45       ` Alexander Lobakin
2024-04-09 16:17         ` Kees Cook
2024-04-10 13:36           ` Alexander Lobakin
2024-04-11  0:54             ` Jakub Kicinski
2024-04-11  9:07               ` Alexander Lobakin
2024-04-11 13:45                 ` Jakub Kicinski
2024-04-04 15:44 ` [PATCH net-next v9 8/9] iavf: pack iavf_ring more efficiently Alexander Lobakin
2024-04-04 15:44 ` [PATCH net-next v9 9/9] iavf: switch to Page Pool Alexander Lobakin

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=e62d9465-7056-4714-9a4e-4645a457774e@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=aleksander.lobakin@intel.com \
    --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=kent.overstreet@linux.dev \
    --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=surenb@google.com \
    /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