| From: |
| Hongfu Li <lihongfu-AT-kylinos.cn> |
| To: |
| tj-AT-kernel.org, hannes-AT-cmpxchg.org, mkoutny-AT-suse.com, corbet-AT-lwn.net, skhan-AT-linuxfoundation.org, dev-AT-lankhorst.se, mripard-AT-kernel.org, natalie.vock-AT-gmx.de |
| Subject: |
| [PATCH 0/2] cgroup/dmem: add per-region event counters |
| Date: |
| Wed, 24 Jun 2026 11:11:05 +0800 |
| Message-ID: |
| <20260624031107.667253-1-lihongfu@kylinos.cn> |
| Cc: |
| cgroups-AT-vger.kernel.org, linux-doc-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, dri-devel-AT-lists.freedesktop.org, Hongfu Li <lihongfu-AT-kylinos.cn> |
| Archive-link: |
| Article |
This patch series adds event counters to the device memory (dmem) cgroup
controller.
The dmem controller exposes per-region limits and current usage, but
not how often those limits are hit. It is hard to tell whether failures
come from this cgroup, a parent limit, or pressure elsewhere in the
hierarchy.
To provide that visibility, this series introduces:
- dmem.events: reports hierarchical low/max counts per region.
- dmem.events.local: reports per-region low/max counts for this cgroup only.
Patch overview:
Patch 1/2:
- Add dmem.events with hierarchical low/max counters per region.
- Record dmem.max allocation failures and dmem.low protection events.
- Document the interface in cgroup-v2.rst.
Patch 2/2:
- Add dmem.events.local for local-only per-region counts.
- Share the events show logic between both files.
- Update cgroup-v2.rst accordingly.
Example output (dmem.events):
drm/0000:03:00.0/vram0 low 0 max 3
drm/0000:03:00.0/stolen low 0 max 0
low - reclaim/eviction considered the cgroup below its effective
dmem.low protection
max - allocation failed because the cgroup or an ancestor hit dmem.max
Both files exist for all non-root cgroups, like dmem.max and dmem.current.
These patches have been tested locally.
Hongfu Li (2):
cgroup/dmem: add per-region event counters
cgroup/dmem: introduce dmem.events.local for local counts
Documentation/admin-guide/cgroup-v2.rst | 17 +++++
kernel/cgroup/dmem.c | 85 ++++++++++++++++++++++++-
2 files changed, 101 insertions(+), 1 deletion(-)
--
2.25.1