Re: [PATCH] tools/mm: add a drgn script to show HugeTLB reservations

From: Aveline Noir

Date: Fri Nov 27 2026 - 23:14:26 EST


Hi Vlastimil,

> and automatically detecting which scheme applies (not from version, but from
> what fields exist or not in the relevant structs, etc). Like e.g. the crash
> tool does.

LGTM! I'll work on that :)

> IMHO it's better if the support is part of drgn itself and can be adjusted
> with kernel changes while still supporting older kernels at the same time,
> [...]
> the user, who doesn't need to fish for the right kernel version's scripts.
> Which may anyway become out of sync because nobody notices, and are only
> fixed in a later version.

Regarding placement, this ties into the discussion you, Omar, and Ye had
back in July:

https://lore.kernel.org/all/20260715-b4-objext_split-v1-0-9a49c4ccf4c3@xxxxxxxxxx/T/

For tools closely tied to subsystem internals and accounting logic, I
think there is still value in keeping them in-tree alongside the kernel
implementation, as it can make tracking relevant changes and maintaining
the tools easier.

It would be nice to reach some consensus on the criteria for making these
decisions. IMHO, the criteria Omar outlined previously seem quite
reasonable:

https://lore.kernel.org/r/aACaf4_molKromnT@telecaster

Adding Ye to Cc since he raised similar questions in July. I'd also be
interested in hearing Andrew's and Omar's thoughts.

Thanks,
Aveline Noir

On Fri, 27 Nov 2026 19:55:45 +0100, "Vlastimil Babka (SUSE)"
<vbabka@xxxxxxxxxx> wrote:
> On 11/27/26 15:01, Aveline Noir wrote:
> > Hi Muchun,
> >
> > On Fri, 27 Nov 2026 19:30:04 +0800 Muchun Song wrote:
> >
> >> The Dragon project itself probably belongs to this type of script? See
> >> here:
> >>
> >> https://github.com/osandov/drgn/tree/main/scripts
> >
> > Thanks for the suggestion! There was a similar discussion when
> > show_page_info.py was proposed for tools/mm/:
> >
> > https://lore.kernel.org/r/aACaf4_molKromnT@telecaster
> >
> > That's mainly why I sent it to the kernel tree instead. Having it close
> > to the code it inspects should make it easier to keep the checks in sync
> > as HugeTLB reservation accounting changes, so it felt like a better fit
> > here. What do you think?
>
> IMHO it's better if the support is part of drgn itself and can be adjusted
> with kernel changes while still supporting older kernels at the same time,
> and automatically detecting which scheme applies (not from version, but from
> what fields exist or not in the relevant structs, etc). Like e.g. the crash
> tool does. Yeah the scripts are then more complex, but it's much easier for
> the user, who doesn't need to fish for the right kernel version's scripts.
> Which may anyway become out of sync because nobody notices, and are only
> fixed in a later version.
>
> > Thanks,
> > Aveline Noir