Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1737757pxu; Tue, 24 Nov 2020 07:47:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaWx6TPoVILWl1egr5mJD7QQg9QnLyQ2MVmCAI6vVU75gNPwSZA+5an11xM7jIm6+N9byo X-Received: by 2002:a05:6402:2d7:: with SMTP id b23mr4341993edx.196.1606232852325; Tue, 24 Nov 2020 07:47:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606232852; cv=none; d=google.com; s=arc-20160816; b=Qi5WAS1sULef/KngM5NglGo2DIQcP38E2mjUxYV1y9BeHexNabyQTi+UJvLu72kB43 VZxyAWVBJJXoCfz1YKspQRQ8NG1axDr9Byks4pWZAdH5Lcqfu4IO8C0MyLs8khpgAHNV TXKrvGmKJ5EbxQGBcA5YHB6g9IarlQatvq36B8uDwe4gg9Nd+zPCOIvuGI4SxGnLU8EE 69dI39/1aQrQLKvnLsVozYDzOWUend5lPBZQAd1jkkQY4O9nfuFlagJh7xcwN2J1TuQ6 96xUX6zTtbizYPFIySrg2yDh0GOyTxAyuUio7uw0QzF0C+2jBtMrLLGbhKgczmx0BvdM tk7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=w9JwNF/HnsOs/5tIwHmp8F8lPNYJfCnT0FcuNfn45GE=; b=igESlqKJVRX4nEblTKtLPZzubqt9HywNLSqTOp3E6VbeLZKlVLtbP2pasWo3pvCq57 DIShTUzfZlmr8v8stZEtIVVAYCjUUasGIHUpzFG3NzYPE9AoAiIYszWknIf0WNET1/89 g9K2LSHug8lLMf83A+bhiQDaQboLWaC80Z/R9r3iHNxmYM3mcbbQgON4yEkPvVClnMok bbPxzb2AvWya7pP5eWiIq1ynpPxP5BaQAM2Ff1s0DneynRwolnZg1dxOvY8wRN0MfntG uOveYOqYk6TH+JtG5Oo0i1zAFl8r4dUQw9OFY2RC9nvaEQgeKdpyn8QC0LUGcLtotv+3 am9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=UreWVn24; 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 n10si3151528edo.182.2020.11.24.07.47.08; Tue, 24 Nov 2020 07:47:32 -0800 (PST) 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=pass header.i=@infradead.org header.s=merlin.20170209 header.b=UreWVn24; 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 S2389842AbgKXPnr (ORCPT + 99 others); Tue, 24 Nov 2020 10:43:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389803AbgKXPnp (ORCPT ); Tue, 24 Nov 2020 10:43:45 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B442C0613D6 for ; Tue, 24 Nov 2020 07:43:45 -0800 (PST) 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=w9JwNF/HnsOs/5tIwHmp8F8lPNYJfCnT0FcuNfn45GE=; b=UreWVn2423H9nZNcsrO7QRxNCG Upj6n43gnmNPt8R4Dk4A1SsM5tcpTceSK+JTYNGQkwOlGaNvqDij9z1bI3ELe2gKGQfy3aPDrfgMi /Z7UVrZhh84ZQQz3vA53u0Eklw5PrYsr7pm+HWlj+4OM6O/XU9LLMOJP3ysn7lB7wySzK06RNdVDQ PCueenZpuYkXW+hZ5Bp5wi/B+uS0BAsz06uIQJitZx548aJjLBF90zjwpQ2pgIQ78jjmqmL7LCPnS 5Rqi2VpwPkTG4mjqi7KzQ001SuEUVkvbTjYpRaipMCCu55f3ElfhAPrzkgzBDdrkk2HO/Qnn2ieDb A4zVmUBA==; 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 1khaSn-0003nu-NG; Tue, 24 Nov 2020 15:42:42 +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 E6DA53012DF; Tue, 24 Nov 2020 16:42:37 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BE4B42008B34C; Tue, 24 Nov 2020 16:42:37 +0100 (CET) Date: Tue, 24 Nov 2020 16:42:37 +0100 From: Peter Zijlstra To: "Li, Aubrey" Cc: Balbir Singh , "Joel Fernandes (Google)" , Nishanth Aravamudan , Julien Desfossez , Tim Chen , Vineeth Pillai , Aaron Lu , Aubrey Li , tglx@linutronix.de, linux-kernel@vger.kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, fweisbec@gmail.com, keescook@chromium.org, kerrnel@google.com, Phil Auld , Valentin Schneider , Mel Gorman , Pawan Gupta , Paolo Bonzini , vineeth@bitbyteword.org, Chen Yu , Christian Brauner , Agata Gruza , Antonio Gomez Iglesias , graf@amazon.com, konrad.wilk@oracle.com, dfaggioli@suse.com, pjt@google.com, rostedt@goodmis.org, derkling@google.com, benbjiang@tencent.com, Alexandre Chartre , James.Bottomley@hansenpartnership.com, OWeisse@umich.edu, Dhaval Giani , Junaid Shahid , jsbarnes@google.com, chris.hyser@oracle.com, Ben Segall , Josh Don , Hao Luo , Tom Lendacky , Aubrey Li , "Paul E. McKenney" , Tim Chen Subject: Re: [PATCH -tip 14/32] sched: migration changes for core scheduling Message-ID: <20201124154237.GZ3021@hirez.programming.kicks-ass.net> References: <20201117232003.3580179-1-joel@joelfernandes.org> <20201117232003.3580179-15-joel@joelfernandes.org> <20201122235456.GF110669@balbir-desktop> <0b2514ef-6cc3-c1a3-280b-5d9062c80a31@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0b2514ef-6cc3-c1a3-280b-5d9062c80a31@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 23, 2020 at 12:36:10PM +0800, Li, Aubrey wrote: > >> +#ifdef CONFIG_SCHED_CORE > >> + /* > >> + * Skip this cpu if source task's cookie does not match > >> + * with CPU's core cookie. > >> + */ > >> + if (!sched_core_cookie_match(cpu_rq(cpu), env->p)) > >> + continue; > >> +#endif > >> + > > > > Any reason this is under an #ifdef? In sched_core_cookie_match() won't > > the check for sched_core_enabled() do the right thing even when > > CONFIG_SCHED_CORE is not enabed?> > Yes, sched_core_enabled works properly when CONFIG_SCHED_CORE is not > enabled. But when CONFIG_SCHED_CORE is not enabled, it does not make > sense to leave a core scheduler specific function here even at compile > time. Also, for the cases in hot path, this saves CPU cycles to avoid > a judgment. No, that's nonsense. If it works, remove the #ifdef. Less (#ifdef) is more. > >> +static inline bool sched_core_cookie_match(struct rq *rq, struct task_struct *p) > >> +{ > >> + bool idle_core = true; > >> + int cpu; > >> + > >> + /* Ignore cookie match if core scheduler is not enabled on the CPU. */ > >> + if (!sched_core_enabled(rq)) > >> + return true; > >> + > >> + for_each_cpu(cpu, cpu_smt_mask(cpu_of(rq))) { > >> + if (!available_idle_cpu(cpu)) { > > > > I was looking at this snippet and comparing this to is_core_idle(), the > > major difference is the check for vcpu_is_preempted(). Do we want to > > call the core as non idle if any vcpu was preempted on this CPU? > > Yes, if there is a VCPU was preempted on this CPU, better not place task > on this core as the VCPU may be holding a spinlock and wants to be executed > again ASAP. If you're doing core scheduling on vcpus, you deserve all the pain possible.