[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1110111810500.10060@chino.kir.corp.google.com>
Date: Tue, 11 Oct 2011 18:20:58 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
cc: Tejun Heo <htejun@...il.com>, Mike Galbraith <efault@....de>,
LKML <linux-kernel@...r.kernel.org>,
Li Zefan <lizf@...fujitsu.com>,
Paul Menage <paul@...lmenage.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [patch] cpusets, cgroups: disallow attaching kthreadd
On Tue, 11 Oct 2011, Peter Zijlstra wrote:
> > Maybe we need a flag to properly indicate "don't diddle with
> > this thread from userland"? But, then, mainline kernel wouldn't need
> > the current PF_THREAD_BOUND at all. Peter, Steven, what do you think?
>
> Strict per-cpu affinity that is needed for correctness and disallows
> sched_setaffinity() is something entirely different from not being
> allowed to put something in a cgroup.
>
Right, I introduced PF_THREAD_BOUND specifically so userspace could not
change the set of allowed cpus of a kthread that has used kthread_bind()
for specific affinity. Any other kthread could set that flag directly to
avoid the same tampering.
The flag was extended for cpusets to avoid having the same kthreads being
moved out of the root cpuset since cpuset.cpus can be changed for all non-
root cpusets to be disjoint. We wanted to avoid an inconsistency where
threads attached to a cpuset had disjoint cpumasks; all threads attached
to a cpuset should have cpumasks that are a subset of cpuset.cpus.
> As to not allowing to put in a cgroup thing, is there anything other
> than kthreadd for which we need to enforce that? So far I've mostly
> treated it like: root can do stupid things, this is one of them, don't
> do that then.
>
Certainly the stop machine migration kthreads and per-cpu watchdog
threads shouldn't be moved out of the root cpuset. Both get
PF_THREAD_BOUND from calling kthread_bind().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists