I have a linux server process that load big resources on startup. This processes will fork on request. The resources that are loaded on startup are the bigest stuff and will not change while runtime. The folked child processes use read/write control structures to handle requests to the constant resources.
How do I find out how much memory is shared between the processes and how many is uinque for every process? Or what pages are duplicated because of write access from any of the processes?
You can get this information from the
/proc/$pid/pagemapand/proc/kpagecountand/proc/kpageflagsvirtual files in the proc filesystem. Access to the latter requires root because it could leak privileged information about process memory mappings you don’t own. ReadDocumentation/vm/pagemap.txtfrom the kernel docs for details on the data format.