Possible working method to get actual process size on Linux

Stefan Karlsson stefan.karlsson at oracle.com
Thu Oct 3 13:01:01 UTC 2019


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
> 


More information about the zgc-dev mailing list