From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751407AbcEKHAu (ORCPT ); Wed, 11 May 2016 03:00:50 -0400 Received: from merlin.infradead.org ([205.233.59.134]:59321 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751308AbcEKHAu (ORCPT ); Wed, 11 May 2016 03:00:50 -0400 Date: Wed, 11 May 2016 09:00:29 +0200 From: Peter Zijlstra To: Yuyang Du Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, clm@fb.com, matt@codeblueprint.co.uk, mgalbraith@suse.de, tglx@linutronix.de, fweisbec@gmail.com Subject: Re: [RFC][PATCH 5/7] sched: Rewrite select_idle_siblings() Message-ID: <20160511070029.GE3193@twins.programming.kicks-ass.net> References: <20160509104807.284575300@infradead.org> <20160509105210.703304637@infradead.org> <20160510210550.GB4870@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160510210550.GB4870@intel.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 11, 2016 at 05:05:50AM +0800, Yuyang Du wrote: > On Mon, May 09, 2016 at 12:48:12PM +0200, Peter Zijlstra wrote: > > + i = select_idle_core(p, sd, target); > > + if ((unsigned)i < nr_cpumask_bits) > > + return i; > > + > > + i = select_idle_cpu(p, sd, target); > > + if ((unsigned)i < nr_cpumask_bits) > > + return i; > > + > > + i = select_idle_smt(p, sd, target); > > + if ((unsigned)i < nr_cpumask_bits) > > + return i; > > First, on smt, these three scans have a lot of overlap, Limited, we stop doing the idle_core scan the moment we fail to find one. And on a busy system it is unlikely to come back. Which leaves us with the straight idle_cpu scan. Sure, the one time we fail to find an idle core and fall through we'll scan double, but that should be rare. > Then, I am still considering combining them a bit, like the following patch. > And if you want, more might be combined. I tried that (and you really want the last idle it finds, to minimize the time between testing for idle and returning it), but it didn't matter for anything I could find.