18

Particularly, does proc always list the VmRSS value in kB? I can't find a solid answer on the documentation, although it appears that it sticks to one unit.

1 Answer 1

21

Yes, it's always in kB. KiB (1024-bytes, not 1000) to be exact.

At least in Linux 4.0 (and this code has been largely unchanged since at least April 2005—that's when Linus switched to git, and I don't care to check back further) that output comes from task_mem in fs/proc/task_mmu.c. Excerpting a few lines:

seq_printf(m,
    "VmPeak:\t%8lu kB\n"
    "VmSize:\t%8lu kB\n"
    "VmLck:\t%8lu kB\n"
    "VmPin:\t%8lu kB\n"
    "VmHWM:\t%8lu kB\n"
    "VmRSS:\t%8lu kB\n"
    "VmData:\t%8lu kB\n"
    "VmStk:\t%8lu kB\n"
    "VmExe:\t%8lu kB\n"
    "VmLib:\t%8lu kB\n"
    "VmPTE:\t%8lu kB\n"
    "VmPMD:\t%8lu kB\n"
    "VmSwap:\t%8lu kB\n",
    hiwater_vm << (PAGE_SHIFT-10),
    ⋮
);

Not sure if you can read C, but that "kB" is hardcoded there. There is no logic to output any other unit.

2
  • 4
    Does the same hold for /proc/meminfo? man 5 proc isn't exactly clear here.
    – olejorgenb
    Commented Feb 3, 2017 at 3:44
  • 5
    @olejorgenb yep, that's hard-coded as kB as well. Look in fs/proc/meminfo.c. (And please send a patch to the manpage to clarify.)
    – derobert
    Commented Feb 3, 2017 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .