All Products
Search
Document Center

Alibaba Cloud Linux:Memcg Exstat feature

Last Updated:Oct 16, 2023

The Memcg Exstat feature is supported in Alibaba Cloud Linux 2 starting with kernel version 4.19.91-18.al7 and Alibaba Cloud Linux 3. This topic describes the Memcg Exstat feature.

Background information

Compared with the Memcg Exstat feature provided by community versions of the Linux kernel, the Memcg Exstat feature that is available for Alibaba Cloud Linux provides the following additional memcg statistical items:

  • Interfaces supported by the cgroup v1 interface: memory.events, memory.events.local, and memory.stat

  • Statistics on latency caused by changes in the global minimum watermark

  • Statistics on latency caused by memcg backend asynchronous reclamation

Feature description

Alibaba Cloud Linux kernel features are implemented based on kernel interfaces. This topic describes the implementation methods for each feature.

Feature

Description

Statistics on memory events

The cgroup v2 interface of community versions of the Linux kernel supports the memory.events and memory.events.local interfaces to show the number of times that specific memory events occurred in a memcg. For more information, visit cgroup-v2.rst.

The cgroup v1 interface of Alibaba Cloud Linux supports the memory.events and memory.events.local interfaces.

Note

The interface files are not stored in the memcg root directory.

Statistics on memory workingsets

The cgroup v2 interface of community versions of the Linux kernel supports the memory.stat interface. The interface file contains the following statistical items: workingset refault, workingset activate, and workingset nodereclaim. For more information, visit cgroup-v2.rst.

The cgroup v1 interface of Alibaba Cloud Linux supports the memory.stat interface. The interface file contains the following statistical items: workingset refault, workingset activate, workingset nodereclaim, and workingset restore. The following content is the official description of workingset restore:

+    workingset_restore
+    Number of restored pages which have been detected as an active
+    workingset before they got reclaimed.

Statistics on latency caused by changes in the global minimum watermark

Alibaba Cloud Linux provides the memcg global minimum watermark rating feature. For more information, see Memcg global minimum watermark rating.

Alibaba Cloud Linux provides statistics on the throttling time that results from the offset global minimum watermark specified in the memcg.exstat interface being exceeded. The statistical item is wmark_min_throttled_ms.

Note

This statistical item is recursive to the parent group, and the interface file is not stored in the memcg root directory.

Statistics description:

  • Interface file: memory.exstat

  • Statistical item: wmark_min_throttled_ms

  • Unit: ms

Statistics on latency caused by memcg backend asynchronous reclamation

Alibaba Cloud Linux provides the memcg backend asynchronous reclaim feature: memcg kswapd. For more information, see Memcg backend asynchronous reclaim.

Alibaba Cloud Linux provides statistics on latency caused by memcg backend asynchronous reclamation in the memcg.exstat interface. These statistics include the amount of blocking time and working time during the reclamation. The statistical item is wmark_reclaim_work_ms.

Note

This statistical item is recursive to the parent group, and the interface file is not stored in the memcg root directory.

Statistics description:

  • Interface file: memory.exstat

  • Statistical item: wmark_reclaim_work_ms

  • Unit: ms

Examples

In this example, a test file is created at the /sys/fs/cgroup/memory mount point of the memcg. Make sure that the memcg file contains the memory.events, memory.events.local, and memory.exstat interface files. Additionally, make sure that the memory.stat interface file contains the workingset statistical item.

  1. Run the following command to create a test file:

    mkdir /sys/fs/cgroup/memory/test
  2. Query the memory.events, memory.events.local, and memory.exstat interfaces.

    1. Run the following command to query the memory.events interface:

      cat /sys/fs/cgroup/memory/test/memory.events

      Sample output:

      low 0
      high 0
      max 0
      oom 0
      oom_kill 0
    2. Run the following command to query the memory.events.local interface:

      cat /sys/fs/cgroup/memory/test/memory.events.local

      Sample output:

      low 0
      high 0
      max 0
      oom 0
      oom_kill 0
    3. Run the following command to query the memory.exstat interface:

      cat /sys/fs/cgroup/memory/test/memory.exstat

      Sample output:

      wmark_min_throttled_ms 0
      wmark_reclaim_work_ms 0
  3. Run the following command to check whether the memory.stat interface file contains the workingset statistical item:

    cat /sys/fs/cgroup/memory/test/memory.stat | grep workingset

    A command output similar to the following one indicates that the interface file contains the workingset statistical item:

    workingset_refault_anon 0
    workingset_refault_file 0
    workingset_activate_anon 0
    workingset_activate_file 0
    workingset_restore_anon 0
    workingset_restore_file 0
    workingset_nodereclaim 0
    total_workingset_refault_anon 0
    total_workingset_refault_file 0
    total_workingset_activate_anon 0
    total_workingset_activate_file 0
    total_workingset_restore_anon 0
    total_workingset_restore_file 0
    total_workingset_nodereclaim 0