Re: [RFC PATCH v1] tools/mm: Add thpmaps script to dump THP usage info

John Hubbard
2024-01-04T22:48:52Z

On 1/3/24 02:20, Ryan Roberts wrote:
> On 03/01/2024 10:09, William Kucharski wrote:
...
>>> The reason is that it is also possible to invoke the tool with --cgroup instead
>>> of --pid. In this case, the tool will iterate over all the pids in the cgroup so
>>> (when --summary is not specified) having the pid associated with each vma is useful.
>>>
>>> I could change it to conditionally output the pid only when --cgroup is specified?
>>
>> You could, or perhaps emit a colon after the pid to delineate it, e.g.:
>>
>>> 000000ce: 0000aaaadbb20000-0000aaaadbb21000 r-xp 00000000 fe:0000426969 /root/a.out
>
> Yeah that sounds like the least worst option. Let's go with that.

I'm trying this out and had the exact same issue with pid. I'd suggest:

a) pid should always be printed in decimal, because that's what ps(1) uses
and no one expects to see it in other formats such as hex.

b) In fact, perhaps a header row would help. There could be a --no-header-row
option for cases that want to feed this to other scripts, but the default
would be to include a human-friendly header.

c) pid should probably be suppressed if --pid is specified, but that's
less important than the other points.

In a day or two I'll get a chance to run this on something that allocates
lots of mTHPs, and give a closer look.

thanks,
--
John Hubbard
NVIDIA