[RFC] [PATCH] Add more info to /proc/$pid/smaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was trying to write a small application similar to pmap, but more powerful.
During the writing I noticed that there are two things I can't get by parsing /proc/$pid/smaps:

1) amount of anonymous memory in a mapping:

It is easy to get it for shared and anonymous mappings (0 for the former, and whole mapping for the latter)
But it is impossible to get it for private writable file mappings.

It seems that the dirty (Private_Dirty+Shared_Dirty) pages amount should indicate number of anonymous pages in the mapping
but this is not the case.

If a dirty page gets swapped, and then brought back due to read access, it will be marked clean, although it is an anonymous page.

2) amount of swapped memory in a mapping:

Again it seems that I can do (Mapping size - RSS) to get amount of memory swapped, but this isn't true too, since
some memory can be untouched , thus be non-present, and non-swapped.


The patch below adds two fields to /proc/$pid/smaps, that give this information.

Probably even more info will be interesting.
How about adding amount of locked memory, and most importantly map count?
This way I can estimate how 'shared' a process memory really is.

Suggestions are welcome.

Best regards,
	Maxim Levitsky
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux