Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932328AbbEKTgb (ORCPT ); Mon, 11 May 2015 15:36:31 -0400 Received: from ja.ssi.bg ([178.16.129.10]:51497 "EHLO ja.ssi.bg" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752145AbbEKTga (ORCPT ); Mon, 11 May 2015 15:36:30 -0400 Date: Mon, 11 May 2015 22:34:11 +0300 (EEST) From: Julian Anastasov To: Peter Zijlstra cc: Ingo Molnar , Linus Torvalds , Oleg Nesterov , linux-kernel@vger.kernel.org, neilb@suse.de Subject: Re: [PATCH] sched: Introduce TASK_NOLOAD and TASK_IDLE In-Reply-To: <20150511142247.GT27504@twins.programming.kicks-ass.net> Message-ID: References: <20150508124748.GH27504@twins.programming.kicks-ass.net> <20150511142247.GT27504@twins.programming.kicks-ass.net> User-Agent: Alpine 2.11 (LFD 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1474 Lines: 43 Hello, On Mon, 11 May 2015, Peter Zijlstra wrote: > > - schedule_timeout_idle (instead of schedule_timeout call): > > __set_current_state(TASK_IDLE); > > return schedule_timeout(timeout); > > > > - we here are really idle, so "N" looks ok > > So I don't get the point of the schedule_timeout_*() stubs. What are > they for? Why would one use an unconditional schedule_timeout() call? > Isn't that what msleep() is for? msleep will not return until timeout has expired. Instead, we want to notice the kthread_should_stop() event immediately. Additionally, TASK_UNINTERRUPTIBLE will increase the load average. We can do it with extra wait queue and the new __wait_event_idle_timeout but I guess schedule_timeout_idle will be a good replacement for schedule_timeout_interruptible calls when used for kthreads. > + * like wait_event_timeout() -- except it uses TASK_IDLE to avoid loadavg > + */ > +#define wait_event_idle_timeout(wq, condition, timeout) \ > +({ \ > + long __ret = timeout; \ > + might_sleep(); \ > + if (!___wait_cond_timeout(condition)) \ > + ret = __wait_event_idle_timeout(wq, condition, timeout);\ ret may need underscores here... Regards -- Julian Anastasov -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/