[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6599ad831003301157p155ca446lce8d6a0e7a70c10e@mail.gmail.com>
Date: Tue, 30 Mar 2010 11:57:14 -0700
From: Paul Menage <menage@...gle.com>
To: paulmck@...ux.vnet.ibm.com
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
dipankar@...ibm.com, akpm@...ux-foundation.org,
mathieu.desnoyers@...ymtl.ca, josh@...htriplett.org,
dvhltc@...ibm.com, niv@...ibm.com, tglx@...utronix.de,
peterz@...radead.org, rostedt@...dmis.org, Valdis.Kletnieks@...edu,
dhowells@...hat.com, eric.dumazet@...il.com, abogani@...ware.it
Subject: Re: [PATCH tip/core/urgent] rcu: protect fork-time cgroup access
On Mon, Mar 29, 2010 at 4:05 PM, Paul E. McKenney
<paulmck@...ux.vnet.ibm.com> wrote:
>
> So I have to ask... What happens if the underlying cgroup is removed
> between the time sched_fork() calls set_task_cpu() and the time that
> copy_process() puts the new task on the tasklist? Or is the initial
> cgroup guaranteed to be immortal?
>
As long as your code is running after cgroup_fork() - which
sched_fork() is - then it should be OK. cgroup_fork() takes a
reference count on the parent's cgroups set, which implicitly keeps
all of those cgroups alive until the task either exits or is moved.
But it can't be moved until it's visible on the task list.
Possibly dup_task_struct should do tsk->cgroups = NULL so that
(currently) unsafe references to the un-refcounted tsk->cgroups before
cgroup_fork() get caught.
Paul
--
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