From: Vassilis Virvilis <v.virvilis@biovista.com>
To: linux-kernel@vger.kernel.org
Subject: Debugging COW (copy on write) memory after fork: Is it possible to dump only the private anonymous memory of a process?
Date: Fri, 05 Apr 2013 12:53:16 +0300 [thread overview]
Message-ID: <515E9F0C.1000204@biovista.com> (raw)
Hello, sorry if this is off topic. Just point me to the right direction.
Please cc me also in the reply.
Question
--------
Is it possible to dump only the private anonymous memory of a process?
Background
----------
I have a process where it reads and it initializes a large portion of
the memory (around 2.3GB). This memory is effectively read only from
that point and on. After the initialization I fork the process to
several children in order to take advantage of the multicore
architecture of modern cpus. The problem is that finally the program
ends up requiring number_of_process * 2.3GB memory effectively entering
swap thrashing and destroying the performance.
Steps so far
------------
The first thing I did is to monitor the memory. I found about
/proc/$pid/smaps and the http://wingolog.org/pub/mem_usage.py.
What happens is the following
The program starts reads from disk and has 2.3GB of private mappings
The program forks. Immediately the 2.3GB become shared mapping
between the parent and the child. Excellent so far.
As the time goes and the child starts performing its tasks the
shared memory is slowly migrating to the private mappings of each
process effectively blowing up the memory requirements.
I thought that if I could see (dump) the private mappings of each
process I could see from the data why the shared mappings are being
touched so I tried to dump the core with gcore and by playing with
/proc/$pid/coredump_filter like this
echo 0x1 > /proc/$pid/coredump_filter
gcore $pid
Unfortunately it always dumps 2.3GB despite the setting in
/proc/$pid/coredump_filter which says private anonymous mappings.
I have researched the question in google.
I even posted it in stack overflow.
Any other ideas?
Thanks in advance
Vassilis Virvilis
next reply other threads:[~2013-04-05 11:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-05 9:53 Vassilis Virvilis [this message]
2013-04-06 18:11 ` Debugging COW (copy on write) memory after fork: Is it possible to dump only the private anonymous memory of a process? Bruno Prémont
2013-04-08 7:41 ` Vassilis Virvilis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=515E9F0C.1000204@biovista.com \
--to=v.virvilis@biovista.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.