Re: [PATCH 1/9] Remove parent field in cpuacct cgroup

From: Glauber Costa
Date: Mon Sep 19 2011 - 12:10:22 EST


On 09/19/2011 01:03 PM, Peter Zijlstra wrote:
On Wed, 2011-09-14 at 17:04 -0300, Glauber Costa wrote:
+ for (; ca; ca = parent_ca(ca)) {

It might be good to check that the loop condition and null condition in
the parent_ca() function get folded. Otherwise there's a double branch
in that loop.

Note that this function is one of the reasons I dislike cpuacct, it adds
a second cgroup hierarchy traversal to every context switch.

Well, it is not that hard to optimize this.

Those values are always updated, but they don't really need to, unless they are read.

So what we can do, is introduce a marker in the cgroup, representing the last read value. Parent is untouched. We then update parent when 1) reading this value, 2) cgroup destroy, 3) cpu hotplug. (humm, and maybe we don't even need to do it in cpu hotplug, since the per-cpu variables will still be accessible... )

How about it ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/