Re: [PATCH] mm: Add AnonZero accounting for zero-filled anonymous pages
From: David Hildenbrand (Arm)
Date: Mon Feb 16 2026 - 12:17:13 EST
On 2/16/26 18:10, Michal Hocko wrote:
On Mon 16-02-26 17:56:12, David Hildenbrand wrote:
On 2/16/26 17:42, Michal Hocko wrote:
You are comparing content of all anon pages, aren't you? Depending on
the content this can add a lot of overhead.
MADV_GET_ZEROPAGE would make more sense to me. But a more fundamental
question is whether this metric is really what you want long term.
Kernel can do all sorts of optimizations behind userspace back - e.g.
map shared zero page - so just learning that a process has a lot of
pages filled up with zeroes doesn't tell you all that much. Or does it?
If a sysadmin wants to see where THP hurt (zero-filled pages), surely
MADV_GET_ZEROPAGE is the wrong (ugly) interface.
The question is whether sysadmin should really ask questions like that.
Without a deeper understanding of the workload the answer could be
misleading at best, no matter what interface is available.
Given the requests for per-process control of THPs I assume some sysadmins (at hyperscalers :) ) really care about the relevant processes and even the relevant memory areas (e.g., jmalloc area).
If you know and understand the workload you already know that THP is not
a good fit and you do not need to ask about that. If you want to
understand whether your particular workload has a big internal
fragmentation due to THPs then MADV_GET_ZEROPAGE sounds like a
reasonable fit to me.
You could also just scan the pages yourself for 0-content, or what's the benefit of letting the kernel do that?
From a sysadmin POV you care about the overall memory consuption, right?
I'm not so sure about that.
--
Cheers,
David