public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* CFS rq lock question
@ 2008-04-11 17:21 Dan Upton
  2008-04-11 17:37 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Upton @ 2008-04-11 17:21 UTC (permalink / raw)
  To: linux-kernel

I'm poking around with some scheduler stuff, and there's something I'm
not clear on for the CFS runqueue locks.  The comments before
__load_balance_iterator(...) in sched_fair.c suggests things can be
dequeued even though the runqueue lock is held.  Can things also be
added to the queue while the lock is held?  (Also, either way, what's
the rationale that dequeueing is a safe procedure when somebody else
holds a lock?)

-dan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CFS rq lock question
  2008-04-11 17:21 CFS rq lock question Dan Upton
@ 2008-04-11 17:37 ` Peter Zijlstra
  2008-04-11 17:41   ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2008-04-11 17:37 UTC (permalink / raw)
  To: Dan Upton; +Cc: linux-kernel, Ingo Molnar

On Fri, 2008-04-11 at 13:21 -0400, Dan Upton wrote:
> I'm poking around with some scheduler stuff, and there's something I'm
> not clear on for the CFS runqueue locks.  The comments before
> __load_balance_iterator(...) in sched_fair.c suggests things can be
> dequeued even though the runqueue lock is held.  Can things also be
> added to the queue while the lock is held?  (Also, either way, what's
> the rationale that dequeueing is a safe procedure when somebody else
> holds a lock?)

/*
 * Load-balancing iterator. Note: while the runqueue stays locked
 * during the whole iteration, the current task might be
 * dequeued so the iterator has to be dequeue-safe. Here we
 * achieve that by always pre-iterating before returning
 * the current task:
 */

I don't think this comment is correct, but if it were, it would only
apply to rq->curr, not for any enqueue/dequeue.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CFS rq lock question
  2008-04-11 17:37 ` Peter Zijlstra
@ 2008-04-11 17:41   ` Peter Zijlstra
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2008-04-11 17:41 UTC (permalink / raw)
  To: Dan Upton; +Cc: linux-kernel, Ingo Molnar

On Fri, 2008-04-11 at 19:37 +0200, Peter Zijlstra wrote:
> On Fri, 2008-04-11 at 13:21 -0400, Dan Upton wrote:
> > I'm poking around with some scheduler stuff, and there's something I'm
> > not clear on for the CFS runqueue locks.  The comments before
> > __load_balance_iterator(...) in sched_fair.c suggests things can be
> > dequeued even though the runqueue lock is held.  Can things also be
> > added to the queue while the lock is held?  (Also, either way, what's
> > the rationale that dequeueing is a safe procedure when somebody else
> > holds a lock?)
> 
> /*
>  * Load-balancing iterator. Note: while the runqueue stays locked
>  * during the whole iteration, the current task might be
>  * dequeued so the iterator has to be dequeue-safe. Here we
>  * achieve that by always pre-iterating before returning
>  * the current task:
>  */
> 
> I don't think this comment is correct, but if it were, it would only
> apply to rq->curr, not for any enqueue/dequeue.
> 

D'oh, I'm silly..

the task can be dequeued because we move it to another cpu.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-11 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-11 17:21 CFS rq lock question Dan Upton
2008-04-11 17:37 ` Peter Zijlstra
2008-04-11 17:41   ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox