On Tue, Jun 24, 2008 at 6:58 AM, Matt Helsley <matthltc@us.ibm.com> wrote:
You can s/Paul Menage's// now that it's in mainline.
That's a bit nasty ...
But hopefully it could go away when the write_string() method is
available in cgroups? (See my patchset from earlier this week).
Is it meant to be OK to move a task into a cgroup that's currently in
the FREEZING state but not yet fully frozen?
I'm not sure that RCU is the right thing for this. All that the RCU
lock will guarantee is that the freezer structure you get a pointer to
doesn't go away. It doesn't guarantee that the task doesn't move
cgroup, or that the cgroup doesn't get a freeze request via a write.
But in this case, the fork callback is called before the task is added
to the task_list/pidhash, or to its cgroups' linked lists. So it
shouldn't be able to change groups. Racing against a concurrent write
to the cgroup's freeze file may be more of an issue.
Can you add a __freeze_task() that has to be called with task_lock(p)
already held?
Maybe BUG_ON(freezer->state == STATE_FROZEN) ?
Technically this could return weird results if someone read it
byte-by-byte and the status changed between reads. If you used
read_seq_string rather than read you'd avoid that.
If you're taking cgroup_lock() here in freezer_write(), there's no
need for the rcu_read_lock() in freezer_freeze()
Paul
--