[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150831152138.GO19282@twins.programming.kicks-ass.net>
Date: Mon, 31 Aug 2015 17:21:38 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Byungchul Park <byungchul.park@....com>
Cc: mingo@...nel.org, linux-kernel@...r.kernel.org, yuyang.du@...el.com
Subject: Re: [PATCH v4 5/5] sched: add two functions for att(det)aching a
task to(from) a cfs_rq
On Thu, Aug 20, 2015 at 08:35:16PM +0900, Byungchul Park wrote:
> On Thu, Aug 20, 2015 at 08:22:00PM +0900, byungchul.park@....com wrote:
> > + /*
> > + * If it's !queued, then only when the task is sleeping it has a
> > + * non-normalized vruntime, that is, when the task is being migrated
> > + * it has a normailized vruntime.
> > + */
>
> i tried to change your XXX comment. i think it can be explaned like this.
> don't you think so? i want to hear any opinions about this.
>
> > + if (p->state == TASK_RUNNING)
> > + return true;
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7943,11 +7943,10 @@ static inline bool vruntime_normalized(s
return true;
/*
- * If it's !queued, then only when the task is sleeping it has a
- * non-normalized vruntime, that is, when the task is being migrated
- * it has a normalized vruntime.
+ * If it's !queued, sleeping tasks have a normalized vruntime,
+ * see dequeue_entity().
*/
- if (p->state == TASK_RUNNING)
+ if (!p->se.on_rq)
return true;
return false;
Does that make sense?
I think using p->state for this is fragile, as we could be racy with any
random blocking primitive that does set_current_state() _before_
actually calling into the scheduler.
--
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