[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bbublxzpnqrzjq5rmmbp772w2darjoahlewqky7caanaknglbx@6wuy5nidsnu3>
Date: Fri, 2 May 2025 14:55:51 +0200
From: Michal Koutný <mkoutny@...e.com>
To: Max Kellermann <max.kellermann@...os.com>
Cc: tj@...nel.org, hannes@...xchg.org, cgroups@...r.kernel.org.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/cgroup/pids: add "pids.forks" counter
Hello Max.
On Fri, May 02, 2025 at 02:19:30PM +0200, Max Kellermann <max.kellermann@...os.com> wrote:
> Counts the number of fork()/clone() calls, similar to the "processes"
> row in /proc/stat, but per cgroup.
> This helps with analyzing who was responsible for peaks in the global
> "processes" counter.
bpftrace <<EOD
kprobe:copy_process
{
@forks[cgroup] = count();
}
END {
for ($kv : @forks) {
printf("%s\t%d\n", cgroup_path($kv.0), (int64)$kv.1);
}
clear(@forks);
}
EOD
> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
...
> + pids.forks
> + A read-only single value file which exists on non-root cgroups.
> +
> + The number of fork()/clone() calls (whether successful or not).
> +
It would conceptually fit better as a pids.stat:forks (but there's no
pids.stat unlike other controllers')
But I don't know this new field justifies introductions of a cgroup
attribute and (yet) another atomic operation on the forking path.
Does the value have long-term or broad use?
Thanks,
Michal
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists