Skip to content

Inconsistent values in cgroup v1 memory.stat: parameters exceed limit and total host memory #30

Closed
@atamanishche

Description

@atamanishche

Description

In cgroup v1, some values in memory.stat (e.g., cache, rss, mapped_file) occasionally exceed both the configured memory limit (memory.limit_in_bytes) and the total physical memory of the host. This behavior has been observed starting with kernel version 5.15.0-300.163.18. The issue was not present in kernel version 5.15.0-209.161.7.2.

The behavior affects not only the cache parameter but also other non-total_* parameters in memory.stat, raising concerns about the reliability of memory accounting.


Steps to Reproduce

  1. Create a cgroup v1 for memory management:

    mkdir /sys/fs/cgroup/memory/test_group
    echo <LIMIT_IN_BYTES> > /sys/fs/cgroup/memory/test_group/memory.limit_in_bytes
    echo $$ > /sys/fs/cgroup/memory/test_group/tasks
  2. Run a workload that creates memory pressure. For example:

    find / -type f > /dev/null
  3. Monitor the values in memory.stat during and after workload execution:

    cat /sys/fs/cgroup/memory/test_group/memory.stat

Environment Details

  • OS: Oracle Linux Server 9.4
  • Kernel Version:
    • Affected: 5.15.0-300.163.18
    • Not affected: 5.15.0-209.161.7.2
  • Cgroup Version: v1 (systemd.legacy_systemd_cgroup_controller, systemd.unified_cgroup_hierarchy=0)
  • Configuration Details:
    • memory.limit_in_bytes: [Specify the limit, e.g., 512M]
    • Workload type: Compression of random data in memory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions