Messages in this thread | | | Date | Fri, 18 Sep 2015 09:12:38 -0700 | Subject | Re: [PATCH] fs-writeback: drop wb->list_lock during blk_finish_plug() | From | Linus Torvalds <> |
| |
On Fri, Sep 18, 2015 at 8:59 AM, Peter Zijlstra <peterz@infradead.org> wrote: > > See PREEMPT_ACTIVE being a recursion flag, we set it there so we won't > preempt while we're already scheduling.
PREEMPT_ACTIVE does more than that. It really is a sign that "this is not synchronous". It causes the scheduler to ignore the current task flags (because it might already be TASK_SLEEPING, but we aren't _actually_ ready to sleep yet) etc.
So no. It's not "you can't be preempted during scheduling". That's the *normal* preempt count, and all scheduling calls end up setting that some way (ie "schedule()" just does preempt_disable()).
So I disagree with your notion that it's a recursion flag. It is absolutely nothing of the sort. It gets set by preemption - and, somewhat illogically, by cond_resched().
The fact that cond_resched() sets it is *probably* because some of the callers end up calling it from page fault paths etc, and the same "ignore TASK_SLEEPING etc" rules apply. But it does mean that "cond_resched()" is a bit misleaning as a name. It's really a "cond_preempt()".
Linus
| |