Re: [PATCH] mm/vmstat: avoid taking zone lock in /proc/buddyinfo reads

From: Vlastimil Babka (SUSE)

Date: Fri Jun 05 2026 - 08:17:09 EST


On 6/4/26 15:42, Imran Khan wrote:
> frag_show_print() just reads zone->free_area[order].nr_free, so
> it can safely do this without needing the zone->lock.
>
> Pass nolock=true from frag_show(), so that walk_zones_in_node()
> can skip the zone->lock acquisition.
>
> Signed-off-by: Imran Khan <imran.f.khan@xxxxxxxxxx>

Acked-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>


> ---
> mm/vmstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index f534972f517de..7b93fbf9af092 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1568,7 +1568,7 @@ static void frag_show_print(struct seq_file *m, pg_data_t *pgdat,
> static int frag_show(struct seq_file *m, void *arg)
> {
> pg_data_t *pgdat = (pg_data_t *)arg;
> - walk_zones_in_node(m, pgdat, true, false, frag_show_print);
> + walk_zones_in_node(m, pgdat, true, true, frag_show_print);
> return 0;
> }
>
>
> base-commit: e43ffb69e0438cddd72aaa30898b4dc446f664f8