Re: [RFC][PATCH 05/18] sched: Provide p->on_rq
From: Frank Rowand
Date: Fri Jan 28 2011 - 19:11:33 EST
On 01/04/11 06:59, Peter Zijlstra wrote:
Provide a generic p->on_rq because the p->se.on_rq semantics are
> unfavourable for lockless wakeups but needed for sched_fair.
>
> In particular, p->on_rq is only cleared when we actually dequeue the
> task in schedule() and not on any random dequeue as done by things
> like __migrate_task() and __sched_setscheduler().
>
> This also allows us to remove p->se usage from !sched_fair code.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> ---
> include/linux/sched.h | 1 +
> kernel/sched.c | 36 ++++++++++++++++++------------------
> kernel/sched_debug.c | 2 +-
> kernel/sched_rt.c | 10 +++++-----
> kernel/sched_stoptask.c | 2 +-
> 5 files changed, 26 insertions(+), 25 deletions(-)
> ===================================================================
> --- linux-2.6.orig/kernel/sched.c
> +++ linux-2.6/kernel/sched.c
> @@ -2571,18 +2570,20 @@ int wake_up_state(struct task_struct *p,
> */
> static void __sched_fork(struct task_struct *p)
> {
> + p->on_rq = 0;
Nitpick: column alignment of "= 0" ^^^^.
> +
> + p->se.on_rq = 0;
> p->se.exec_start = 0;
> p->se.sum_exec_runtime = 0;
> p->se.prev_sum_exec_runtime = 0;
> p->se.nr_migrations = 0;
> + INIT_LIST_HEAD(&p->se.group_node);
>
> #ifdef CONFIG_SCHEDSTATS
> memset(&p->se.statistics, 0, sizeof(p->se.statistics));
> #endif
>
> INIT_LIST_HEAD(&p->rt.run_list);
> - p->se.on_rq = 0;
> - INIT_LIST_HEAD(&p->se.group_node);
>
> #ifdef CONFIG_PREEMPT_NOTIFIERS
> INIT_HLIST_HEAD(&p->preempt_notifiers);
>
-Frank
--
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/