PERF-KMEM(1)

πŸ’… PERF-KMEM (from the perf Manual, bestie) ✨

Okay so real talk: perf-kmem is the tool that traces and measures kernel memory properties. She's giving observability main character energy and honestly? Obsessed. πŸŽ€


✨ SYNOPSIS ✨

perf kmem [<options>] {record|stat}

πŸ¦‹ DESCRIPTION πŸ¦‹

There are literally two variants of perf kmem, and you gotta pick your fighter:

  • 'perf kmem [<options>] record [<perf-record-options>] <command>' β€” this one records the kmem events of an arbitrary workload. And yes, you can sneak extra perf record options in after record, like -o to change the output file name. iykyk πŸ’…
  • 'perf kmem [<options>] stat' β€” this one reports kernel memory statistics. The chill, read-only vibe. 🧚

🌸 OPTIONS 🌸

  • -i <file>, --input=<file> β€” for stat, this picks the input file (default: perf.data β€” unless stdin is a fifo, girl knows how to improvise 🫢).
  • -f, --force β€” don't do ownership validation. Just vibes. No questions asked.
  • -v, --verbose β€” be more verbose (shows symbol address, etc). She will tell you everything. 😭
  • --caller β€” show per-callsite statistics. Who called whom. The receipts. πŸ”₯
  • --alloc β€” show per-allocation statistics. One at a time, bestie.
  • -s <key[,key2...]>, --sort=<key[,key2...]> β€” sort the output. Default is frag,hit,bytes for slab and bytes,hit for page. Available sort keys are ptr, callsite, bytes, hit, pingpong, frag for slab, and page, callsite, bytes, hit, order, migtype, gfp for page. ⚠️ Heads up: this option should be preceded by one of the mode selection options β€” i.e. --slab, --page, --alloc and/or --caller. Don't just raw-dog the sort key, it needs context.
  • -l <num>, --line=<num> β€” print n lines only. Boundaries! We love them. πŸ’œ
  • --raw-ip β€” print raw ip instead of symbol. No translation, just the cold hard number.
  • --slab β€” analyze SLAB allocator events. 🧊
  • --page β€” analyze page allocator events. πŸ“„
  • --live β€” show live page stat. By default perf kmem shows total allocation stat, but this option shows live (currently allocated) pages instead. Note: this one works with the --page option only, so don't try it solo, it will not slay. πŸ’€
  • --time=<start>,<stop> β€” only analyze samples within the given time window: <start>,<stop>. Times have the format seconds.microseconds. If start is not given (i.e., the time string is ,x.y) then analysis starts at the beginning of the file. If stop time is not given (i.e., the time string is x.y,) then analysis goes to end of file. Open-ended queen. 🌈

πŸ‘‘ SEE ALSO πŸ‘‘


Go forth and measure that kernel memory, bestie. The allocations are quaking. πŸ’–

That was PERF-KMEM(1) β€” from the perf manual, dated 10/31/2026, and she's PERF-KMEM(1) shaped, periodt. πŸ¦‹βœ¨

πŸ“¦ where this page comes from