Re: [patch 0/2] cpusets, cpu_cgroup: disallow attaching kthreadd

From: Tejun Heo
Date: Fri Apr 20 2012 - 13:55:41 EST


Hello,

On Mon, Apr 09, 2012 at 05:52:50PM -0700, David Rientjes wrote:
> On Sun, 8 Apr 2012, Hiroyuki Kamezawa wrote:
>
> > I'm sorry if I didn't read e-mails while a trip....let me understand...
> >
> > - Tejun at el, tries to disallow to move kthreadd into cgroups other than root.
> > - You wants to account kthreadd's activity under memg at el.
> >
>
> memcg isn't the only use case, you can also use it for cpuacct and any
> other future cgroup that wants to do so.
>
> > Then, 2 question from me is....
> > 1. If this patch only affects kthreadd, you can move other
> > kthread. Is this correct ?
> >
>
> Yes, but not those that are forked by kthreadd at runtime without some
> delay between the fork and attaching it to a different cgroup. With memcg
> slab accounting, for example, allocating the task_struct for the kthread
> should appropriately be accounted for in a non-root memcg.
>
> Keep in mind that this isn't only limited to memcg, I've just used it to
> illustrate how account for slab is useful. I don't know everybody's use
> cases where they may want to do the same thing so I've been arguing
> against unnecessarily restricting it from all cgroups other than those
> that require it (cpuset and cpu).
>
> Using cpusets as an example, we can even completely remove the restriction
> on attaching all PF_THREAD_BOUND threads by not allowing them only if the
> destination cpuset has mems that are disjoint from the bound cpu and
> disallow changing the mems to be disjoint from a member's bound cpu.

So, the scheduler / arch people don't seem too happy with the prospect
of basic system kthreads living in !root cgroups and memcg people seem
willing to fix up whatever accounting deficiency in root memcg and I'm
not convinced the left use cases are all that useful / important.
There inherently are system-wide things (things happen w/o task
context and thus w/o any cgroup associated). Just leave them in the
rootcg. If you have to move kthreads to !root cgroups for accounting,
then do so on your own. The only downsides are small delays and kmem
accounting inaccuracy from kthread allocation.

Thanks.

--
tejun
--
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/