/proc/pid/statm reports incorrect library size

From: Jon McClintock (jonm@bluemug.com)
Date: Tue Jul 18 2000 - 17:06:50 EST


Hello,

On my 2.2.15 systems, /proc/pid/statm consistently reports zero for number of
pages that are library. Looking at the code (fs/proc/array.c):

      while (vma) {
         pgd_t *pgd = pgd_offset(tsk->mm, vma->vm_start);
         int pages = 0, shared = 0, dirty = 0, total = 0;

         statm_pgd_range(pgd, vma->vm_start, vma->vm_end, &pages, &shared, &dirty, &total);
         resident += pages;
         share += shared;
         dt += dirty;
         size += total;
         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)
            lrs += pages; /* library */
         else
            drs += pages;
         vma = vma->vm_next;
      }

We see that it counts all pages above 0x60000000 as library. However,
on my systems, library is mapped to 0x40000000.

Simply changing the value to 0x40000000 causes statm to report correct(er)
values. However, it seems that this hueristic is awful dependant upon the
userspace library mapping. Is there a better way to check that a page is
library data?

-Jon

BTW: The documentation for proc lists the values for statm in the wrong order.
     drs and lrs should be swapped.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jul 23 2000 - 21:00:11 EST