Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753333AbbEIJAK (ORCPT ); Sat, 9 May 2015 05:00:10 -0400 Received: from ja.ssi.bg ([178.16.129.10]:47957 "EHLO ja.ssi.bg" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752373AbbEIJAG (ORCPT ); Sat, 9 May 2015 05:00:06 -0400 X-Greylist: delayed 536 seconds by postgrey-1.27 at vger.kernel.org; Sat, 09 May 2015 05:00:06 EDT Date: Sat, 9 May 2015 11:49:01 +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: <20150508124748.GH27504@twins.programming.kicks-ass.net> Message-ID: References: <20150508124748.GH27504@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: 1866 Lines: 52 Hello, On Fri, 8 May 2015, Peter Zijlstra wrote: > Subject: sched: Introduce TASK_NOLOAD and TASK_IDLE > From: Peter Zijlstra > Date: Fri May 8 14:23:45 CEST 2015 > > Currently people use TASK_INTERRUPTIBLE to idle kthreads and wait for > 'work' because TASK_UNINTERRUPTIBLE contributes to the loadavg. Having > all idle kthreads contribute to the loadavg is somewhat silly. > > Now mostly this works OK, because kthreads have all their signals > masked. However there's a few sites where this is causing problems and > TASK_UNINTERRUPTIBLE should be used, except for that loadavg issue. > > This patch adds TASK_NOLOAD which, when combined with > TASK_UNINTERRUPTIBLE avoids the loadavg accounting. > > As most of imagined usage sites are loops where a thread wants to > idle, waiting for work, a helper TASK_IDLE is introduced. After checking our code in net/netfilter/ipvs/ip_vs_sync.c, sync_thread_master(), we may also need some wrappers: - 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 - pair of __wait_event_idle(wq, condition) and wait_event_idle(wq, condition) macros - we here are write-blocked for socket, not sure if this blocked vs idle difference is useful to represent, in new bit for this blocked state "B"=2048, with 2 TASK_NOLOAD variants: N(idle) and B(blocked, 2|1024|2048, eg. for read-blocked or write-blocked). It will need additional argument 'state'/'blocked' for *wait_event_idle(). 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/