Re: [PATCH] tools/mm: add a drgn script to show HugeTLB reservations
From: Omar Sandoval
Date: Mon Nov 30 2026 - 19:40:36 EST
On Fri, Nov 27, 2026 at 08:14:19PM -0800, Aveline Noir wrote:
> 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.
To be fair, just about everything in drgn is closely tied to subsystem
internals, so I don't think that has much weight on where a script
should go, and that wasn't my point in
https://lore.kernel.org/r/aACaf4_molKromnT@telecaster.
To phrase my preferred guidelines from that message differently:
1. How reusable is it?
a. Very generic -> drgn helper
b. Specific but generally useful -> drgn tool or contrib directory
c. Very specific to a handful of developers of a specific subsystem
-> kernel tree
2. Who will test and maintain it for kernel changes?
a. Kernel developer -> kernel tree
b. Author will support all kernel versions and write unit tests ->
drgn can take it and maintain it from there
c. Nobody -> either drgn contrib directory or kernel tree, doesn't
really matter. The former is usually easier
Thanks,
Omar