linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] vmalloc: Add for_each_vmap_node() helper
@ 2025-04-08 15:15 Uladzislau Rezki (Sony)
  2025-04-08 15:15 ` [PATCH 2/3] vmalloc: Switch to " Uladzislau Rezki (Sony)
  2025-04-08 15:15 ` [PATCH 3/3] vmalloc: Use for_each_vmap_node() in purge-vmap-area Uladzislau Rezki (Sony)
  0 siblings, 2 replies; 6+ messages in thread
From: Uladzislau Rezki (Sony) @ 2025-04-08 15:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, LKML, Christoph Hellwig, Uladzislau Rezki,
	Oleksiy Avramchenko

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-10  9:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 15:15 [PATCH 1/3] vmalloc: Add for_each_vmap_node() helper Uladzislau Rezki (Sony)
2025-04-08 15:15 ` [PATCH 2/3] vmalloc: Switch to " Uladzislau Rezki (Sony)
2025-04-09 17:39   ` kernel test robot
2025-04-10  0:32     ` Andrew Morton
2025-04-10  9:34       ` Uladzislau Rezki
2025-04-08 15:15 ` [PATCH 3/3] vmalloc: Use for_each_vmap_node() in purge-vmap-area Uladzislau Rezki (Sony)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).