What is the unit of "mem" and "memory" in /proc/net/sockstat

Kyle Brandt asked:

What is the unit of mem and memory in /proc/net/sockstat? Bytes, KBytes, Pages?

[kbrandt@ny-kbrandt01: ~] cat /proc/net/sockstat
sockets: used 153
TCP: inuse 7 orphan 0 tw 0 alloc 8 mem 1
UDP: inuse 4 mem 3
UDPLITE: inuse 0
RAW: inuse 0
FRAG: inuse 0 memory 0

My answer:

There seems to be no documentation of this besides the kernel source itself, and I presume you don’t want to dig quite that deep.

After digging through several pages of search results I finally found one forum post from someone who apparently did read the kernel source, which claims that the mem values for TCP and UDP are in kernel pages, while the memory value in FRAG is in bytes.

I glanced at the corresponding sources myself, and this seems to be true. Though, I am no kernel expert and frequently get lost in that maze…

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.