Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp455125ybz; Fri, 17 Apr 2020 04:20:34 -0700 (PDT) X-Google-Smtp-Source: APiQypKVBye7qcDwNuC7lU24huXKmjOYNSXEzDUZIIb/UVB5gPenZYE9rdGOjuJsK9G5cD+oc8FV X-Received: by 2002:a17:906:af6f:: with SMTP id os15mr2553193ejb.78.1587122434062; Fri, 17 Apr 2020 04:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587122434; cv=none; d=google.com; s=arc-20160816; b=Ek7XGHTrbdwGY5nMWB2lOy93Ss05bIz4g6oIh8M7NQxxjdVOpaM2mvcfubkukUhjB2 PTGegwtKZPUXaE5Aa1J9Mb1ZXAttaeeUL/OkYOi+v267oHxwaREawqDgfCR2psoTwMx9 bljcFVMrqjTQbV0TIE6edI9HiP4SXNsukuKDCsEXg+syld+bhJaUHQzx8vCtLnRMj8Ue 7JbgUquVvSDwQPTVI2fmOHKu1hoAlq56vDlqepZjLgYeA74A6tdBUkOk8NqqDhYh0C0R abfE4OcAtMXdoAhwC5A8+aX8FEViSJgUmiUEaRTr+Uz7IghBAMquTovVOtS1d8FElosC opyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=/ZnqPGloz5qpK7/E1IaNFav8MSspX6hYlLoRkVBqIng=; b=FgX1yJ0BP+TFxmHZAmkoH5C6JWo0KO3uEr9q9tm6YOE7dJmgjSR8ymdYdVXrlhoai+ E22vT+20nP3O2hQjUfYsgopqyKuIyuw8i21SaN+SUQepk3EeRITgWr2EsZqpdGoHHYu7 w4tdLq1Ppb6cfjyGPhqUMXc/6gv9uiIaMdQoLR5dso0rMYoWlmGAPI+h+y5AiItfvq72 oSNEs8xIZoqIdBwOWO5K3qVD8hHDqwybIXfQkyZhnSWspjhkr+x8QHtyZDDNl0WRXgtZ oDtfgf18aahE3/k9ZZFpGzRH4uWV34Sy3akD60QH1J1ESFIXLWGeJaOnOp3i7MdDtWBM BQAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="tx/xJ3ff"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j21si13305999ejv.161.2020.04.17.04.20.10; Fri, 17 Apr 2020 04:20:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="tx/xJ3ff"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730236AbgDQLSl (ORCPT + 99 others); Fri, 17 Apr 2020 07:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729962AbgDQLSl (ORCPT ); Fri, 17 Apr 2020 07:18:41 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEED9C061A0C for ; Fri, 17 Apr 2020 04:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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; bh=/ZnqPGloz5qpK7/E1IaNFav8MSspX6hYlLoRkVBqIng=; b=tx/xJ3ffFqDu/kEWIYVfjBGeWX tTPu4RI5XglLsKjomE+B2jjZcnPKb1o2UCr4HRqB/ey7RBetv9MdeFijz24J1XrjGxGeNC1Na5NbT a/F+w69aipGcQHPoANnRuAOccl/GykEc2qeRM2Rbn/lH7l01/TaCGSwd5nRJdTn0BrbRxOTNLrmLj MhBHLaT1x1SMo4WcVuyx0pT91BM9alES/51BuYzr1iLnPBFnk4tY/5bkUF+DeJ6GY9XBxvR/doHD4 UuQR2QzoTQYR15dqRAeWdy3nTsprcrKvEp7KT/Y7uFlXMRPr8/gw+PCV2b+3Swerk/VgbW+AXCZeQ QdLX1H5w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jPP0Z-0006Hw-NL; Fri, 17 Apr 2020 11:18:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 79C1F3006E0; Fri, 17 Apr 2020 13:18:05 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3E3D42B1214B0; Fri, 17 Apr 2020 13:18:05 +0200 (CEST) Date: Fri, 17 Apr 2020 13:18:05 +0200 From: Peter Zijlstra To: Chen Yu Cc: vpillai , Nishanth Aravamudan , Julien Desfossez , Tim Chen , mingo@kernel.org, tglx@linutronix.de, pjt@google.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Aaron Lu , Aubrey Li , aubrey.li@linux.intel.com, Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , Joel Fernandes , joel@joelfernandes.org, Aaron Lu , Long Cui Subject: Re: [RFC PATCH 07/13] sched: Add core wide task selection and scheduling. Message-ID: <20200417111805.GA20730@hirez.programming.kicks-ass.net> References: <20200416033804.GA5712@HP-G1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200416033804.GA5712@HP-G1> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 16, 2020 at 11:39:05AM +0800, Chen Yu wrote: > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 02495d44870f..ef101a3ef583 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -4477,9 +4477,14 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) > return next; > } > > - prev->sched_class->put_prev_task(rq, prev); > - if (!rq->nr_running) > - newidle_balance(rq, rf); > + > +#ifdef CONFIG_SMP > + for_class_range(class, prev->sched_class, &idle_sched_class) { > + if (class->balance(rq, prev, rf)) > + break; > + } > +#endif > + put_prev_task(rq, prev); > > smt_mask = cpu_smt_mask(cpu); Instead of duplicating that, how about you put the existing copy in a function to share? finish_prev_task() perhaps? Also, can you please make newidle_balance() static again; I forgot doing that in 6e2df0581f56, which would've made you notice this sooner I suppose.