mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* negative anon_rss?
@ 2006-11-15  0:30 Pádraig Brady
  2006-11-15 14:45 ` Hugh Dickins
  0 siblings, 1 reply; 2+ messages in thread
From: Pádraig Brady @ 2006-11-15  0:30 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: Lauri Lubi

Sorry for not sending this to linux-mm,
but I can't subscribe at present? Anyway...

I wrote the following script to try and accurately determine
how much RAM a particular program uses:
http://www.pixelbeat.org/scripts/ps_mem.py

A user reported an issue on debian with kernel 2.6.8-2-386
where many processes were being reported as using
a negative amount of memory.

I asked him to run the following:

  (
    echo total rss shared trs - drs -
    for pid in `pidof apache2`; do
        cat /proc/$pid/statm
    done
  ) | column -t

the output of which was:

  total  rss   shared  trs  -  drs   -
  6580   2306  5273    95   0  6485  0
  6580   2313  5273    95   0  6485  0
  6119   1717  5269    95   0  6024  0
  6630   2371  5273    95   0  6535  0
  6735   2503  5273    95   0  6640  0
  6773   2546  5273    95   0  6678  0
  5845   1146  5198    95   0  5750  0

Notice the large values for the shared column.
Also notice that the shared column is larger than rss!?
I had assumed that shared was a subset of rss from
the following (pseudo) code from fs/proc/task_mmu.c::task_statm()

  *total  = mm->total_em
  *shared = get_mm_counter(mm, file_rss)
  *rss    = *shared + get_mm_counter(mm, anon_rss)
  *trs    = mm->end_code - mm->start_code
  *drs    = mm->total_vm - mm->shared_vm

Therefore anon_rss must be negative in the kernel?
So there is a mismatch between pages being marked
as anonymous and anon_rss being updated appropriately?

cheers,
Pádraig.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-15 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-15  0:30 negative anon_rss? Pádraig Brady
2006-11-15 14:45 ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome