diff mbox series

[1/3] vmalloc: Add for_each_vmap_node() helper

Message ID 20250408151549.77937-1-urezki@gmail.com (mailing list archive)
State New
Headers show
Series [1/3] vmalloc: Add for_each_vmap_node() helper | expand

Commit Message

Uladzislau Rezki April 8, 2025, 3:15 p.m. UTC
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.

Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
---
 mm/vmalloc.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index bcc90d4357e48..e42ea20713dc7 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)
 {