[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1224361698.10548.38.camel@lappy.programming.kicks-ass.net>
Date: Sat, 18 Oct 2008 22:28:18 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Cyrill Gorcunov <gorcunov@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: CFS related question
On Sun, 2008-10-19 at 00:03 +0400, Cyrill Gorcunov wrote:
> Hi Ingo, Peter,
>
> I just curious, look we have the following
>
> static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
> {
> struct sched_entity *se = NULL;
>
> if (first_fair(cfs_rq)) {
> se = __pick_next_entity(cfs_rq);
> se = pick_next(cfs_rq, se);
> set_next_entity(cfs_rq, se);
> }
>
> return se;
> }
>
> which I presume may return NULL so the following piece
> could fail
>
> static struct task_struct *pick_next_task_fair(struct rq *rq)
> {
> struct task_struct *p;
> struct cfs_rq *cfs_rq = &rq->cfs;
> struct sched_entity *se;
>
> if (unlikely(!cfs_rq->nr_running))
> return NULL;
>
> do {
> --> se = pick_next_entity(cfs_rq);
> --> OOPs cfs_rq = group_cfs_rq(se);
> } while (cfs_rq);
>
> p = task_of(se);
> hrtick_start_fair(rq, p);
>
> return p;
> }
>
> Did I miss something? Or it comepletely can NOT happen?
pick_next_entity() only returns NULL when !first_fair(), which is when !
nr_running.
So the initial !nr_running check in pick_next_task_fair() will catch
that. Further nested RQs will never have !nr_running because then they
get dequeued.
--
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