]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
kfifo: add kfifo_alloc_node() helper for NUMA awareness
authorMing Lei <ming.lei@redhat.com>
Fri, 21 Nov 2025 01:58:23 +0000 (09:58 +0800)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Nov 2025 16:20:13 +0000 (09:20 -0700)
commit9574b21e952256d4fa3c8797c94482a240992d18
tree1ecb0c305ef434290da40e28ae9f717c5b93e8ce
parent89e1fb7ceffd898505ad7fa57acec0585bfaa2cc
kfifo: add kfifo_alloc_node() helper for NUMA awareness

Add __kfifo_alloc_node() by refactoring and reusing __kfifo_alloc(),
and define kfifo_alloc_node() macro to support NUMA-aware memory
allocation.

The new __kfifo_alloc_node() function accepts a NUMA node parameter
and uses kmalloc_array_node() instead of kmalloc_array() for
node-specific allocation. The existing __kfifo_alloc() now calls
__kfifo_alloc_node() with NUMA_NO_NODE to maintain backward
compatibility.

This enables users to allocate kfifo buffers on specific NUMA nodes,
which is important for performance in NUMA systems where the kfifo
will be primarily accessed by threads running on specific nodes.

Cc: Stefani Seibold <stefani@seibold.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/kfifo.h
lib/kfifo.c