support filter subsystem on `cgroup.Stat()` function
@linrl3 is already working on this.
Since Oct 22, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go, linux
- Domain
- operating-systems
Research direction
Start at the cgroup.Stat entry point and trace the ContainerStats and PodStats call chains described in the issue, checking how subsystem queries are selected. Done means callers can request only needed subsystems such as CPU and memory, avoiding redundant queries such as repeated /proc/partitions reads.
Written by the indexing model from the issue text.
Description
When we check metrics using the CRI interface, it queries all subsystems. However, in practice, we might only need CPU and memory information, making the other queries unnecessary and redundant. The metrics interface is often called frequently and periodically.
The call chain is usually ContainerStats -> cgroup.Stat(cntid) or PodStats -> cgroup.Stat(cndids...). For PodStats, this triggers multiple ContainerStats calls.
We've encountered an issue where /proc/partitions is read too frequently which will cause spin locks during the read process.
bt script code:
bpftrace -e '
BEGIN {
@start_time = nsecs;
printf("Tracing container processes opening /proc/partitions... (Start Time: %d)\n", @start_time);
}
kprobe:vfs_open
/ strncmp(comm, "containerd", 10) == 0 && str(((struct path *)arg0)->dentry->d_name.name) == "partitions" /
{
@open_count[comm, str(((struct path *)arg0)->dentry->d_name.name)] = count();
}
END {
$end_time = nsecs;
printf("\nTracing finished. (End Time: %d)\n", $end_time);
$duration = ($end_time - @start_time) / 1000000000; // 转换为秒
printf("Total duration: %d seconds\n", $duration);
printf("\nTracing results:\n");
print(@open_count);
}
'
// output
Tracing finished. (End Time: 1684141913)
Total duration: 9 seconds
Tracing results:
@open_count[containerd-shim, partitions]: 322
// vfs_read kstack
@last_stack[120]: (
klist_next+180 <------- spin_lock
class_dev_iter_next+64
disk_seqf_start+128
show_partition_start+44
seq_read+168
proc_reg_read+128
__vfs_read+72
vfs_read+156
ksys_read+108
__arm64_sys_read+36
el0_svc_handler+176
el0_svc+8
,
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 255
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from containerd/cgroups
-
cgroup v1 blkio parser aborts on "(unknown)" device rows, causing all container stats to failPossibly taken @ShravanthReddy claimed this 94 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 72/100
containerd/cgroups#393 ·
-
Add inspection for cgroup v2 CPU quota and periodPossibly taken @linrl3 claimed this 41 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
containerd/cgroups#377 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
containerd/cgroups#364 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
containerd/cgroups#328 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
containerd/cgroups#301 · 1 comment ·
All issues in containerd/cgroups
Similar issues
-
P3 tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
kind/feature needs-triage priority/unprioritized
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
NVIDIA/k8s-test-infra#1504 ·
Maintainers usually reply within 1 day
-
Area/Infrastructure Aspect/Infra Resources Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
wso2/agent-manager#2717 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
open-policy-agent/opa#9685 · 1 comment ·
Maintainers usually reply within 1 day