aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorUladzislau Rezki (Sony) <[email protected]>2025-04-08 15:15:47 +0000
committerAndrew Morton <[email protected]>2025-05-12 00:48:20 +0000
commit4318255091eab6722bea3816bdee09ac7db68035 (patch)
treea61c3b9d829455ab73d019229a5a715bd5b586de /mm/vmalloc.c
parentfs/proc/page: refactor to reduce code duplication (diff)
downloadkernel-4318255091eab6722bea3816bdee09ac7db68035.tar.gz
kernel-4318255091eab6722bea3816bdee09ac7db68035.zip
vmalloc: add for_each_vmap_node() helper
To simplify iteration over vmap-nodes, add the for_each_vmap_node() macro that iterates over all nodes in a system. It tends to simplify the code. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Cc: Christop Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 44b735a4573a..55949360a5cb 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -900,6 +900,11 @@ static struct vmap_node *vmap_nodes = &single;
static __read_mostly unsigned int nr_vmap_nodes = 1;
static __read_mostly unsigned int vmap_zone_size = 1;
+/* A simple iterator over all vmap-nodes. */
+#define for_each_vmap_node(vn) \
+ for ((vn) = &vmap_nodes[0]; \
+ (vn) < &vmap_nodes[nr_vmap_nodes]; (vn)++)
+
static inline unsigned int
addr_to_node_id(unsigned long addr)
{