Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp978114rdd; Wed, 10 Jan 2024 05:20:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsyy2CxFv53N6e8IzwL0LoKzWi5ILFaCSMBADg9ag+OJIfl8gz+T5e0xHC164LEHYqXFh5 X-Received: by 2002:a05:620a:4156:b0:783:3321:d2e1 with SMTP id k22-20020a05620a415600b007833321d2e1mr1205626qko.46.1704892858769; Wed, 10 Jan 2024 05:20:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704892858; cv=none; d=google.com; s=arc-20160816; b=0zpqGvconAaGM0075g+tvjgMpEFVH5apDob9puCtxpq6avcGPecq5+Rzc/9KxEncZW ca4TpcBof40nOczLA/i0cBactDvJya53oqysU5l/N83A8zbMSb92Fn+BgjYCIJ7bM6vW J4PPdaG8QMwTSSpPg6kKQ5rQKNZIXx3kSDpxOZkixcsN+eOk/6iKVHHHiQ7bKjpEd8p+ zZZbpNAOeyaYdHIHi/e540rOKz5NrcNISiulwfgM4DhJR6+vlnjhnVNEj0QuV+9Wpcs3 X1XTm4BQfmgIzhkKb3oFLYZIqV3jzkIxZIQSIq+JwAsJZ8iPSknYjx2g79b1a5lGISZs dPwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LJsF1MczUBjnXyCG7xyNVeCxEmhd1IW5HePVhZ5oNug=; fh=6tiFKlZ3syfwhA35mRKGg+CYPaiU5h8lcP+GI/cxfgw=; b=k5lc5vMjep4KSs9JmH4zi4EdjJjs0LRHsrt3dNceG2t8bwyXV6K7h1o4KKjWpyUCLE Iy3efewDXyEpvxSmSU+94i5KCD7dJu3far6T/xfML7mL18ujJNZATm0TXNhgIglcKbtI mh6K9OSjMPdbRC3OUx4sWHb39tA/qnQjj7CNyzVL9LecCpe3LXykdj+GdqDbz18uTEfg HTMhwXledyHLqScFirLEwaYMbjHAqDPkpiUac2BQJA0PO+TBtWS8kyfwUc/G2Kc+Us6C 4wRXqvtExaKDRl+toGu8UETenf81FCYZzLgC5CbHUBx6f6HZpUFHNdjLfhFg2zIZTBWo GzaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=N8XaOJlo; spf=pass (google.com: domain of linux-kernel+bounces-22223-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22223-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m17-20020ae9e711000000b00781555ae8basi3991470qka.210.2024.01.10.05.20.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 05:20:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22223-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=N8XaOJlo; spf=pass (google.com: domain of linux-kernel+bounces-22223-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22223-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 188AD1C222C5 for ; Wed, 10 Jan 2024 13:20:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A5C148CE0; Wed, 10 Jan 2024 13:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=inria.fr header.i=@inria.fr header.b="N8XaOJlo" Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C30DB48CC0 for ; Wed, 10 Jan 2024 13:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=inria.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LJsF1MczUBjnXyCG7xyNVeCxEmhd1IW5HePVhZ5oNug=; b=N8XaOJloTgmNOhwBhqTGhet3S9Q7nfE+d0qNpWLxdblZR8jRJ4Jek6Hk pCCxFrkDl9O3ifX3nEcY6KYel2O1SVyuA4uEe2+qs8YP9bwkIoxNoQPMc kQkMu94vOmSY/3h9EFjp5M2Y1puYSjSnsBDoqDcAC3M98tKIK7gEp9rvW o=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=keisuke.nishimura@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.04,184,1695679200"; d="scan'208";a="145881889" Received: from dt-aponte.paris.inria.fr (HELO keisuke-XPS-13-7390.tailde312.ts.net) ([128.93.67.66]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 14:19:45 +0100 From: Keisuke Nishimura To: Ingo Molnar , Peter Zijlstra , Vincent Guittot Cc: linux-kernel@vger.kernel.org, Dietmar Eggemann , Mel Gorman , Valentin Schneider , Julia Lawall , Xunlei Pang , Abel Wu , Keisuke Nishimura Subject: [PATCH v2 2/2 RESEND] sched/fair: take into account scheduling domain in select_idle_core() Date: Wed, 10 Jan 2024 14:17:07 +0100 Message-Id: <20240110131707.437301-2-keisuke.nishimura@inria.fr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240110131707.437301-1-keisuke.nishimura@inria.fr> References: <20240110131707.437301-1-keisuke.nishimura@inria.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When picking out a CPU on a task wakeup, select_idle_core() has to take into account the scheduling domain where the function looks for the CPU. This is because the "isolcpus" kernel command line option can remove CPUs from the domain to isolate them from other SMT siblings. This change replaces the set of CPUs allowed to run the task from p->cpus_ptr by the intersection of p->cpus_ptr and sched_domain_span(sd) which is stored in the cpus argument provided by select_idle_cpu. Fixes: 9fe1f127b913 ("sched/fair: Merge select_idle_core/cpu()") Signed-off-by: Keisuke Nishimura Signed-off-by: Julia Lawall --- v2: - Changed the log message to mention only isolcpus kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 66457d4b8965..e2b4e0396af8 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7289,7 +7289,7 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu if (!available_idle_cpu(cpu)) { idle = false; if (*idle_cpu == -1) { - if (sched_idle_cpu(cpu) && cpumask_test_cpu(cpu, p->cpus_ptr)) { + if (sched_idle_cpu(cpu) && cpumask_test_cpu(cpu, cpus)) { *idle_cpu = cpu; break; } @@ -7297,7 +7297,7 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu } break; } - if (*idle_cpu == -1 && cpumask_test_cpu(cpu, p->cpus_ptr)) + if (*idle_cpu == -1 && cpumask_test_cpu(cpu, cpus)) *idle_cpu = cpu; } -- 2.34.1