/proc/<pid>/statm glitch in 2.0.33 and 2.1.97

Chris Siebenmann (cks@hawkwind.utcs.toronto.edu)
Mon, 20 Apr 1998 19:21:22 -0400


/proc/<pid>/statm appears to always report 0 for 'lrs' (the fifth
number, which comments suggest has to do with how many pages of shared
libraries the process is using). I think this is because the get_statm()
routine in fs/proc/array.c is using an old and now obsolete test for
this. Here's a patch against 2.0.33 to change it to something deduced
from examining how task_mem() appears to do it.

Possibly the /proc/<pid>/statm interface is obsolete, but I hope not;
it appears to give some information not readily available from elsewhere
(particularly the total size vs resident pages information).

--- fs/proc/array.c 1998/04/20 05:37:03 1.1
+++ fs/proc/array.c 1998/04/20 05:38:00
@@ -826,9 +826,9 @@
if (vma->vm_flags & VM_EXECUTABLE)
trs += pages; /* text */
else if (vma->vm_flags & VM_GROWSDOWN)
drs += pages; /* stack */
- else if (vma->vm_end > 0x60000000)
+ else if (vma->vm_flags & VM_EXEC)
lrs += pages; /* library */
else
drs += pages;
vma = vma->vm_next;

- cks

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu