Ideas for DMP to show shared memory?

43 views
Skip to first unread message

Nirav Gandhi

unread,
Jul 21, 2014, 5:31:11 AM7/21/14
to dmp...@chromium.org
After going through the DMP code, I have come to realise that the DMP simply sums up the unhooked memory regions despite them being shared with the other processes sometimes. For eg. the unhooked regions in the .heap files of both the main and render process are very similar i.e memory is being shared. 

Is there an accurate way for the DMP to show the shared memory instead of the actual memory being taken up by the processes? Can it be as simple as comparing the .heap files of the 2 processes and counting only half the region if it exists for both processes?

Nirav   

Dai Mikurube

unread,
Jul 22, 2014, 12:19:02 AM7/22/14
to Nirav Gandhi, dmprof
It's not documented (sorry about that), but dmprof supports analyzing
shared memory using /proc/.../pagemap and kpagecount. The feature is
not very sophisticated to use yet.

If you're interested, try an envvar DEEP_HEAP_PROFILE_PAGEFRAME=2 for
your target processes. You need to have a read access to
/proc/kpagecount. It adds page frame information in .heap files. The
post-mortem "dmprof" script considers the page frames if the policy
contains "sharedwith" attributes.
> --
> You received this message because you are subscribed to the Google Groups
> "dmprof" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dmprof+un...@chromium.org.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/dmprof/28177a85-91a7-4887-bd5c-1b7eaeb9360f%40chromium.org.



--
Dai MIKURUBE
dmik...@chromium.org

Nirav Gandhi

unread,
Jul 26, 2014, 7:14:56 AM7/26/14
to dmp...@chromium.org, ngand...@gmail.com
Hi Dai,

After looking at the code for what you have mentioned below, the user can only get to know if the memory is shared or not. Do you think it can be more advantageous to the user if we divide the amount of memory by the number of processes sharing it?

Nirav

Dai Mikurube

unread,
Jul 27, 2014, 10:20:56 AM7/27/14
to Nirav Gandhi, dmprof
Hi Nirav,

Hm, what you want is PSS (Proportional Set Size) or like Exmap (http://www.berthels.co.uk/exmap/) ? I think it's feasible in dmprof, but not prioritized in my side at this time -- we thought it's not a very useful metric.

If you're interested, design docs and patches are welcome in dmprof. :)  Dumped data of dmprof (around kpagecount and pagemap) should have enough information to do that -- we only need the post-mortem analyzer.

Note that we should be always aware of the definition of "share". For example, shared only with processes which you're interested or shared with any process in the computer.


WenSheng He

unread,
Jul 28, 2014, 11:31:46 PM7/28/14
to dmp...@chromium.org, ngand...@gmail.com
I also believe that PSS is not useful, as it is a sum of private + shared / count. The each part of them seems more useful than the sum result. But PSS may be for leaders as usual, not engineers.
Currently dmprof only supports to analyze one process, I wonder if it will be more useful to analyze Chrome as an entity? 
Then it will tell us Chrome's private memory usage, shared with other programs. For shared only inside Chrome's different processes is also private.
Of course, each process information is also useful.

在 2014年7月27日星期日UTC+8下午10时20分56秒,Dai Mikurube写道:

WenSheng He

unread,
Jul 29, 2014, 3:23:52 AM7/29/14
to dmp...@chromium.org, ngand...@gmail.com
Ah, maybe  DEEP_HEAP_PROFILE_PAGEFRAME=2 works as I said? I'll have a try.

在 2014年7月29日星期二UTC+8上午11时31分46秒,WenSheng He写道:

Nirav Gandhi

unread,
Jul 29, 2014, 3:32:59 AM7/29/14
to dmp...@chromium.org, ngand...@gmail.com
Yes, setting DEEP_HEAP_PAGEFRAME=2 does work. It breaks 'unhooked-non-exec' further into 'unhooked-non-exec-group' and 'unhooked-non-exec-others' which shows the amount of memory shared.

Nirav
Reply all
Reply to author
Forward
0 new messages