* [PATCH for-4.4-fixes] cgroup_pids: don't account for the root cgroup
@ 2015-11-30 22:45 Tejun Heo
2015-12-03 15:17 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2015-11-30 22:45 UTC (permalink / raw)
To: Li Zefan; +Cc: Johannes Weiner, cgroups, linux-kernel, Aleksa Sarai
>From 7bbb8d4e913853a1346d95745ca8092f0cc8ce00 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Mon, 30 Nov 2015 17:24:34 -0500
Because accounting resources for the root cgroup sometimes incurs
measureable overhead for workloads which don't care about cgroup and
often ends up calculating a number which is available elsewhere in a
slightly different form, cgroup is not in the business of providing
system-wide statistics. The pids controller which was introduced
recently was exposing "pids.current" at the root. This patch disable
accounting for root cgroup and removes the file from the root
directory.
While this is a userland visible behavior change, pids has been
available only in one version and was badly broken there, so I don't
think this will be noticeable. If it turns out to be a problem, we
can reinstate it for v1 hierarchies.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Aleksa Sarai <cyphar@cyphar.com>
---
kernel/cgroup_pids.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup_pids.c b/kernel/cgroup_pids.c
index 8e27fc5..b50d5a1 100644
--- a/kernel/cgroup_pids.c
+++ b/kernel/cgroup_pids.c
@@ -106,7 +106,7 @@ static void pids_uncharge(struct pids_cgroup *pids, int num)
{
struct pids_cgroup *p;
- for (p = pids; p; p = parent_pids(p))
+ for (p = pids; parent_pids(p); p = parent_pids(p))
pids_cancel(p, num);
}
@@ -123,7 +123,7 @@ static void pids_charge(struct pids_cgroup *pids, int num)
{
struct pids_cgroup *p;
- for (p = pids; p; p = parent_pids(p))
+ for (p = pids; parent_pids(p); p = parent_pids(p))
atomic64_add(num, &p->counter);
}
@@ -140,7 +140,7 @@ static int pids_try_charge(struct pids_cgroup *pids, int num)
{
struct pids_cgroup *p, *q;
- for (p = pids; p; p = parent_pids(p)) {
+ for (p = pids; parent_pids(p); p = parent_pids(p)) {
int64_t new = atomic64_add_return(num, &p->counter);
/*
@@ -298,6 +298,7 @@ static struct cftype pids_files[] = {
{
.name = "current",
.read_s64 = pids_current_read,
+ .flags = CFTYPE_NOT_ON_ROOT,
},
{ } /* terminate */
};
--
2.5.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH for-4.4-fixes] cgroup_pids: don't account for the root cgroup
2015-11-30 22:45 [PATCH for-4.4-fixes] cgroup_pids: don't account for the root cgroup Tejun Heo
@ 2015-12-03 15:17 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2015-12-03 15:17 UTC (permalink / raw)
To: Li Zefan; +Cc: Johannes Weiner, cgroups, linux-kernel, Aleksa Sarai
On Mon, Nov 30, 2015 at 05:45:43PM -0500, Tejun Heo wrote:
> From 7bbb8d4e913853a1346d95745ca8092f0cc8ce00 Mon Sep 17 00:00:00 2001
> From: Tejun Heo <tj@kernel.org>
> Date: Mon, 30 Nov 2015 17:24:34 -0500
>
> Because accounting resources for the root cgroup sometimes incurs
> measureable overhead for workloads which don't care about cgroup and
> often ends up calculating a number which is available elsewhere in a
> slightly different form, cgroup is not in the business of providing
> system-wide statistics. The pids controller which was introduced
> recently was exposing "pids.current" at the root. This patch disable
> accounting for root cgroup and removes the file from the root
> directory.
>
> While this is a userland visible behavior change, pids has been
> available only in one version and was badly broken there, so I don't
> think this will be noticeable. If it turns out to be a problem, we
> can reinstate it for v1 hierarchies.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Aleksa Sarai <cyphar@cyphar.com>
Applying to cgroup/for-4.4-fixes.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-03 15:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-30 22:45 [PATCH for-4.4-fixes] cgroup_pids: don't account for the root cgroup Tejun Heo
2015-12-03 15:17 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®