Skip to content

Linux: reading smaps_rollup every 2 s costs large processes more than the resident set did #636

Backlog

Description

@7schmiede

Since ADR-0119 a process's memory on Linux is its proportional set (Pss),
read from /proc/<pid>/smaps_rollup on every usage sample (every 2 s) for a
service tree without a usable cgroup (crates/devstack-proc/src/linux.rs).

For each read the kernel walks all of the process's memory mappings and page
tables under its memory-map lock. For large processes (.NET, the JVM, a Node
dev server with gigabytes mapped) that costs far more than the one field of
statm read before, both in the daemon's CPU and as lock contention for the
measured process's own mmap/munmap.

To decide: read smaps_rollup less often than the cheap figures (every
10–30 s, statm in between, scaled by the last ratio), or only for the
largest processes of a tree, or keep it as it is and measure first. A
measurement on a node with a few .NET lanes would settle it.

Found in the code review before 0.54.0.

Activity

  1. added
    enhancement
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions