Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758831AbcCVNId (ORCPT ); Tue, 22 Mar 2016 09:08:33 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:32770 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756959AbcCVNIZ (ORCPT ); Tue, 22 Mar 2016 09:08:25 -0400 Date: Tue, 22 Mar 2016 14:08:23 +0100 From: Michal Hocko To: Peter Zijlstra Cc: Andrew Morton , linux-mm@kvack.org, LKML , Tetsuo Handa , David Rientjes , Ingo Molnar Subject: Re: [PATCH 1/9] sched: add schedule_timeout_idle() Message-ID: <20160322130822.GF10381@dhcp22.suse.cz> References: <1458644426-22973-1-git-send-email-mhocko@kernel.org> <1458644426-22973-2-git-send-email-mhocko@kernel.org> <20160322122345.GN6344@twins.programming.kicks-ass.net> <20160322123314.GD10381@dhcp22.suse.cz> <20160322125113.GO6344@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160322125113.GO6344@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1869 Lines: 50 On Tue 22-03-16 13:51:13, Peter Zijlstra wrote: > On Tue, Mar 22, 2016 at 01:33:14PM +0100, Michal Hocko wrote: > > On Tue 22-03-16 13:23:45, Peter Zijlstra wrote: > > > On Tue, Mar 22, 2016 at 12:00:18PM +0100, Michal Hocko wrote: > > > > > > > extern signed long schedule_timeout_interruptible(signed long timeout); > > > > extern signed long schedule_timeout_killable(signed long timeout); > > > > extern signed long schedule_timeout_uninterruptible(signed long timeout); > > > > +extern signed long schedule_timeout_idle(signed long timeout); > > > > > > > +/* > > > > + * Like schedule_timeout_uninterruptible(), except this task will not contribute > > > > + * to load average. > > > > + */ > > > > +signed long __sched schedule_timeout_idle(signed long timeout) > > > > +{ > > > > + __set_current_state(TASK_IDLE); > > > > + return schedule_timeout(timeout); > > > > +} > > > > +EXPORT_SYMBOL(schedule_timeout_idle); > > > > > > Yes we have 3 such other wrappers, but I've gotta ask: why? They seem > > > pretty pointless. > > > > It seems it is just too easy to miss the __set_current_state (I am > > talking from my own experience). > > Well, that's what you get; if you call schedule() and forget to set a > blocking state you also don't block, where the problem? The error prone nature of schedule_timeout usage was the reason to introduce them in the first place IIRC which makes me think this is something that is not so uncommon. [...] > > > Why not kill the lot? > > > > We have over 400 users, would it be much better if we open code all of > > them? It doesn't sound like a huge win to me. > > Dunno, changing them around isn't much work, we've got coccinelle for > that. If that sounds like a more appropriate plan I won't object. I can simply change my patch to do __set_current_state and schedule_timeout. -- Michal Hocko SUSE Labs