From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH] fs-writeback: drop wb->list_lock during blk_finish_plug() Date: Tue, 29 Sep 2015 09:55:41 +0200 Message-ID: <20150929075541.GA30097@gmail.com> References: <20150918054044.GT3902@dastard> <20150918131615.GI8624@ret.masoncoding.com> <55FC1E72.3040500@fb.com> <20150918155956.GZ3816@twins.programming.kicks-ass.net> <20150928144757.GB2881@worktop.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Peter Zijlstra , Jens Axboe , Frederic Weisbecker , Chris Mason , Dave Chinner , Jan Kara , Josef Bacik , LKML , linux-fsdevel , Neil Brown , Christoph Hellwig , Tejun Heo To: Linus Torvalds Return-path: Received: from mail-wi0-f177.google.com ([209.85.212.177]:38626 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755642AbbI2Hzp (ORCPT ); Tue, 29 Sep 2015 03:55:45 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: * Linus Torvalds wrote: > On Mon, Sep 28, 2015 at 10:47 AM, Peter Zijlstra wrote: > > > >> It gets set by preemption - and, > >> somewhat illogically, by cond_resched(). > > > > I suspect that was done to make cond_resched() (voluntary preemption) > > more robust and only have a single preemption path/logic. But all that > > was done well before I got involved. > > So I think it's actually the name that is bad, not necessarily the behavior. > > We tend to put "cond_resched()" (and particularly > "cond_resched_lock()") in some fairly awkward places, and it's not > always entirely clear that task->state == TASK_RUNNING there. > > So the preemptive behavior of not *really* putting the task to sleep > may actually be the right one. But it is rather non-intuitive given > the name - because "cond_resched()" basically is not at all equivalent > to "if (need_resched()) schedule()", which you'd kind of expect. > > An explicit schedule will actually act on the task->state, and make us > go to sleep. "cond_resched()" really is just a "voluntary preemption > point". And I think it would be better if it got named that way. cond_preempt() perhaps? That would allude to preempt_schedule() and such, and would make it clearer that it's supposed to be an invariant on the sleep state (which schedule() is not). Thanks, Ingo