Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1779168yba; Fri, 10 May 2019 00:32:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBmMXEOdwnfFtxAEfPBkzubm65RzDhEeKVjAty4b1bxf4rDfMQ6oyETBNlDx7Hx3/94m/e X-Received: by 2002:a63:1558:: with SMTP id 24mr11978616pgv.126.1557473572817; Fri, 10 May 2019 00:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557473572; cv=none; d=google.com; s=arc-20160816; b=x0sdbLcx4uI1cejQ4bG2Wut66dh5dORc2fI32IVfaESm6qeQcDbPf6HiOzPLi/x2F1 n/o0FbyGWlc2hTM0LsQja8OyD/2cfmumBtMSMkskhnJh/RZjHVTxrORN9l54KX/+imyW sClUxYUX9zA3DCjBDTyZm8sseS10zLDBnLYQtaCHeQRpHp2b/y1t7N0cHbJYVtT+DaLa 0Hhhaa8lhtVc58/Yb7iikOQ7e6hGeOpVel+GNGJ9p9H2T24SOIRYqg+0eZ0G3k1TQ5UO m0Lyrbl14Yj1GThSSEWHtkjv1aWLYj//OxOHya35tAMum5963roCdi4JL26x8LWKaXrT elSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uwdIcBUmVfzWGoctVjnYH5rQgHvL0u+qnruw3GjdPnQ=; b=k9I2fXXjLcjuDglIKYm0dhWlLGOM4WD4gYRvMVtA4Dtf2XGvC+chCTc25jg75eLT9I QNTiQuIJwdAK9qlrnSVTM1fJRnvwpwtdjpiYXABtWcTV8jO82HRXa91eWySH8WeVzY0U m1lVW9iShdJXFvS3xDtD7oCDfkCkhwRn2uA1OXGqRs6Mck8nCGGl3R1JTNRd94kY1mn+ RaKq/bZlNPVr7sBfA4ahojzCBCvp+TLnUbZwALFNYQ8eWSW1wKYhTOEqk6cmGz9NM1/o 7PgvjHgPyGBb9r6spNBZa9EagjAMfH58MfvOFrftIOehyWUIx+bGmfx4g2N6QaPhyqVs i3eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lNZ7a6py; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si5954092plq.268.2019.05.10.00.32.36; Fri, 10 May 2019 00:32:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lNZ7a6py; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727237AbfEJHVe (ORCPT + 99 others); Fri, 10 May 2019 03:21:34 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37246 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727224AbfEJHVc (ORCPT ); Fri, 10 May 2019 03:21:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uwdIcBUmVfzWGoctVjnYH5rQgHvL0u+qnruw3GjdPnQ=; b=lNZ7a6pyI902Z6aRZzYeDPq0C ogGK4N60ciJU0RpHq9y23wowsXTmw4T8f65owtYKg5qPv2FhCxNKTaZQCIDsXOBFKAJK9aa+ofjeG 02ywY6seKiw1eJG2CGOx7yzEhurAbHsdN2+B8DU24ZC0yCYhOhB14jC6UYk0EIYu/X4o5GJDCH7yh egTsl2ZM+/ZIizCeUGYiOx6paEC6OXqlmOnZzMIEiiCWmgIfdpECmhYg/7G6shfflk4MnkLpwMmgE ak8Ne95SMzCWbfFnn7OnCWfRFeHaQoIFiH63YHneljN2aMIgIrBnfSz8s5a5oi2Tsv21rVT8tfqAu g5p5RFxLA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hOzqS-0004cY-2M; Fri, 10 May 2019 07:21:28 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 07C83284B2F48; Fri, 10 May 2019 09:21:26 +0200 (CEST) Date: Fri, 10 May 2019 09:21:25 +0200 From: Peter Zijlstra To: Viresh Kumar Cc: Ingo Molnar , Vincent Guittot , tkjos@google.com, Daniel Lezcano , quentin.perret@linaro.org, chris.redpath@arm.com, Dietmar.Eggemann@arm.com, linux-kernel@vger.kernel.org, steven.sistare@oracle.com Subject: Re: [RFC V2 2/2] sched/fair: Fallback to sched-idle CPU if idle CPU isn't found Message-ID: <20190510072125.GG2623@hirez.programming.kicks-ass.net> References: <59b37c56b8fcb834f7d3234e776eaeff74ad117f.1556182965.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <59b37c56b8fcb834f7d3234e776eaeff74ad117f.1556182965.git.viresh.kumar@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 25, 2019 at 03:07:40PM +0530, Viresh Kumar wrote: > We target for an idle CPU in select_idle_sibling() to run the next task, > but in case we don't find idle CPUs it is better to pick a CPU which > will run the task the soonest, for performance reason. A CPU which isn't > idle but has only SCHED_IDLE activity queued on it should be a good > target based on this criteria as any normal fair task will most likely > preempt the currently running SCHED_IDLE task immediately. In fact, > choosing a SCHED_IDLE CPU shall give better results as it should be able > to run the task sooner than an idle CPU (which requires to be woken up > from an idle state). > > This patch updates the fast path to fallback to a sched-idle CPU if the > idle CPU isn't found, the slow path can be updated separately later. > > Following is the order in which select_idle_sibling() picks up next CPU > to run the task now: > > 1. idle_cpu(target) OR sched_idle_cpu(target) > 2. idle_cpu(prev) OR sched_idle_cpu(prev) > 3. idle_cpu(recent_used_cpu) OR sched_idle_cpu(recent_used_cpu) > 4. idle core(sd) > 5. idle_cpu(sd) > 6. sched_idle_cpu(sd) > 7. idle_cpu(p) - smt > 8. sched_idle_cpu(p)- smt > > Though the policy can be tweaked a bit if we want to have different > priorities. I don't hate his per se; but the whole select_idle_sibling() thing is something that needs looking at. There was the task stealing thing from Steve that looked interesting and that would render your apporach unfeasible.