lkml.org 
[lkml]   [2011]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 2/3] sched, workqueue: Move WQ-sleeper wakeup
On Wed, Jun 22, 2011 at 11:27:28AM +0200, Peter Zijlstra wrote:
> On Wed, 2011-06-22 at 11:24 +0200, Tejun Heo wrote:
> > Preemption could still be enabled here, right? What prevents
> > preemtion kicking after wq_worker_sleeping() and do it again thus
> > breaking nr_running tracking.
>
> Aren't all PF_WQ_WORKER threads cpu-bound?

Hmmm... I don't see how that would matter. Please consider the
following scenario.

* A work item calls schedule() for whatever reason.

* schedule() calls sched_submit_work() which in turn calls
wq_worker_sleeping() which adjusts nr_running. All this happens
with preemption enabled.

* sched_submit_work() returns but before schedule() does
preempt_disable(), an IRQ is delivered. By the time IRQ return path
is executed, TIF_NEED_RESCHED is set which in turn calls schedule()
again and repeats the above two steps for the same worker.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2011-06-22 11:39    [W:0.039 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site