Re: [RFC PATCH 15/15] nohz_task: Procfs interface

From: Frederic Weisbecker
Date: Mon Dec 20 2010 - 10:57:52 EST


On Mon, Dec 20, 2010 at 04:42:24PM +0100, Peter Zijlstra wrote:
> On Mon, 2010-12-20 at 16:24 +0100, Frederic Weisbecker wrote:
> > This implements the /proc/pid/nohz file that enables the
> > nohz attribute of a task.
> >
> > Synchronization is enforced so that:
> >
> > - A CPU can have only one nohz task
>
> Why?


This is because of the hooks we have with entering/exiting userspace.
The "wants to enter extended quiescent" variable (nohz_task_ext_qs)
is per CPU and applies to any nohz task.

If A and B are nohz task bound to the same CPU,

A enters userspace, says it can enter extended quiescent state
(nohz_task_ext_qs = 1).
B preempts it and enters kernel, hence saying that it doesn't want
extended quiescent state (nohz_task_ext_qs = 0). B sleeps, we return
to A which said that it wants extended quiescent state but the per cpu
var has been screwed (nohz_task_ext_qs == 0).

But this can be solved using a per task variable. I just thought it
wouldn't be very useful to have two nohz task on a same CPU, but actually
why not.

> > - A nohz task can be only affine to a single CPU
>
> Why?

Same problem, we need to make some things per task. That's fixable,
This will may be add a bit of complexity and since I couldn't find
a usecase for migratable nohz tasks, I did not handled that case.

Should I?

> > For now this is only possible to write on /proc/self but probably
> > allowing it from another task would be a good idea and wouldn't
> > increase so much the complexity of the code.
>
> ptrace rules might match that.

You think I should use the ptrace interface? Hmm, dunno if it's
appropriate.
--
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/