Re: Does the copy-on-write usually happen on application startup?

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

 



Mauricio Lin wrote:

Hi Jim,


--- Jim Cromie <jcromie@xxxxxxxxxx> escreveu:

Rik van Riel wrote:
<MMAP_PRIVATE stuff, snipped>
is this a common thing ? or, why would shared-libs be written to, except for
self-modifying code ?
linking of dynamically loaded libs ( ie loaded
mid-run ) ?

heres the /proc/$$/maps taken from a bash shell.

I presume all the w pages are COW-able

to try to answer myself, I did this:

[root@harpo proc]# more 6761/maps |wc
    26     151    1669
[root@harpo proc]# sort {6697,6761}/maps |wc
    52     302    3338
[root@harpo proc]# sort -u {6697,6761}/maps |wc
    36     208    2297


The pid 6697 and 6761 are not sharing the same VMAs,
right?

dunno.

Do you know anyway to track cow pages based on maps
informations among processes that share the same VMAs?

For instance, the firefox browser has some processes
inside the /proc/pid/task and AFAIK the pids under
this directory share the same VMAs. You can see those
information through maps for each pid.

dunno that either.  Rik's the guru in this thread.
I only read about these things when they hit LWN.

but fwiw,
[jimc@harpo lxbuild]$ ls -d /proc/*/task |wc
   134     134    2117
[jimc@harpo lxbuild]$ ls -d /proc/*/task/* |wc
   151     151    3118

which I infer means that only 17 pids are threads.
since threads share address-space, (processes do not)
Id expect that VMAs are shared amongst threads only.
But then, i dunno squat about VMAs.

and - lo and behold - firefox is the biggest single chunk of those threads:

[jimc@harpo 6899]$ more cmdline
/usr/lib/firefox-1.0.4/firefox-bin
[jimc@harpo 6899]$ ls task
6899  6905  6914  6950  7916  7947  7948  7949

[jimc@harpo 6899]$ cat task/*/maps |wc
  2384   13992  188192
[jimc@harpo 6899]$ cat task/*/maps |sort -u |wc
   298    1749   23524
[jimc@harpo 6899]$ more task/6899/maps |wc
   298    1749   23524

wow - all the maps are identical.  *even* the stack !?!

[jimc@harpo 6899]$ cat task/*/maps |grep stack
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]
bfc87000-bfc9c000 rw-p bfc87000 00:00 0          [stack]

that stack cant really be the one in use. ?!?

Its also interesting that theres no evidence of TLS in the map.

So, any idea about cow pages among processes that
share same VMAs?

none - I hope for forthcoming enlighenment.

BR,

Mauricio Lin.

btw, whats BR ?    Viva Brazilia or similar ?
Viva Lula !

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux