Possible working method to get actual process size on Linux

Stefan Reich stefan.reich.maker.of.eye at googlemail.com
Thu Oct 3 13:30:27 UTC 2019


Not sure if there is a way to avoid /smaps at all, all the tools I've seen
seem to rely one it.

On Thu, 3 Oct 2019 at 15:24, Stefan Reich <
stefan.reich.maker.of.eye at googlemail.com> wrote:

> Hi Stefan,
>
> thanks for the hint. It hopefully won't block longer than it takes to read
> the file, no?
>
> It does appear to take a bit to do that, I'm seeing ~ .25 s for cat
> /proc/.../smaps > dev/null
>
> Greetings,
> Stefan
>
> On Thu, 3 Oct 2019 at 15:01, Stefan Karlsson <stefan.karlsson at oracle.com>
> wrote:
>
>> Hi Stefan,
>>
>> On 2019-10-03 12:19, Stefan Reich wrote:
>> > I'm still trying to get Linux to report a correct process size when
>> using
>> > ZGC (the memory multi-mapping issue).
>> >
>> > My idea is to parse /proc/pid/smaps.
>>
>> I'd like to point out that reading this file will most likely block the
>> entire process from making progress. We've seen instances where reading
>> this file caused the application and JVM to stand still for multiple
>> seconds. If your applications are latency sensitive you'd probably want
>> to avoid doing this.
>>
>> Cheers,
>> StefanK
>>
>>
>>   Sadly, I can't see physical addresses
>> > there, only virtual ones. So I group by virtual address range. Here's
>> what
>> > I got for an example process with is reported by top as 2.7 GB:
>> >
>> > Address range 000000xxxxxxxxxx: 6 MB
>> > Address range 000004xxxxxxxxxx: 38 MB
>> > Address range 000007xxxxxxxxxx: 646 MB
>> > Address range 000008xxxxxxxxxx: 38 MB
>> > Address range 00000bxxxxxxxxxx: 631 MB
>> > Address range 000010xxxxxxxxxx: 38 MB
>> > Address range 000013xxxxxxxxxx: 690 MB
>> > Address range 00007fxxxxxxxxxx: 726 MB
>> >
>> > It appears I have to discount the 07, 0b and 13 ranges to get to a
>> > reasonable actual process size of 844 MB.
>> >
>> > Question: Are these address ranges fixed or does ZGC choose different
>> ones
>> > depending on heap size? Where exactly do the address ranges begin and
>> end?
>> >
>> > As soon as this reporting method works, let's publish it as a standard
>> tool
>> > for anyone using ZGC on Linux. I can't be the only one who's driven
>> nuts by
>> > not knowing how big my processes are.
>> >
>> > Greetings,
>> > Stefan
>> >
>>
>
>
> --
> Stefan Reich
> BotCompany.de // Java-based operating systems
>


-- 
Stefan Reich
BotCompany.de // Java-based operating systems


More information about the zgc-dev mailing list