[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240314005436.2962962-4-mcgrof@kernel.org>
Date: Wed, 13 Mar 2024 17:54:35 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: akpm@...ux-foundation.org,
jhubbard@...dia.com,
vbabka@...e.cz,
mgorman@...e.de,
linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org,
dave@...olabs.net,
p.raghav@...sung.com,
da.gomez@...sung.com,
mcgrof@...nel.org
Subject: [PATCH 3/3] mm/vmstat: simplfy extfrag_show_print with fragmentation_index()
fragmentation_index() already uses the stack for the struct contig_page_info,
so just use that and enhance the documentation for fragmentation_index().
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
mm/vmstat.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index db79935e4a54..582f89b37ccf 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1129,7 +1129,10 @@ unsigned int extfrag_for_order(struct zone *zone, unsigned int order)
info.free_pages);
}
-/* Same as __fragmentation index but allocs contig_page_info on stack */
+/*
+ * Same as __fragmentation index but allocs contig_page_info on stack,
+ * useful when walking a zone as interrupts are disabled.
+ */
int fragmentation_index(struct zone *zone, unsigned int order)
{
struct contig_page_info info;
@@ -2227,15 +2230,11 @@ static void extfrag_show_print(struct seq_file *m,
unsigned int order;
int index;
- /* Alloc on stack as interrupts are disabled for zone walk */
- struct contig_page_info info;
-
seq_printf(m, "Node %d, zone %8s ",
pgdat->node_id,
zone->name);
for (order = 0; order < NR_PAGE_ORDERS; ++order) {
- fill_contig_page_info(zone, order, &info);
- index = __fragmentation_index(order, &info);
+ index = fragmentation_index(zone, order);
seq_printf(m, "%2d.%03d ", index / 1000, index % 1000);
}
--
2.43.0
Powered by blists - more mailing lists