From nobody Fri Feb 13 00:20:48 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C8981BD9F8 for ; Fri, 3 Jan 2025 06:59:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735887597; cv=none; b=XDmDVQhEKqTPcav+60C4MPGTseJtps2JabkVK6m2Qz3Iyr+8jaWVVeFNlIHxOyUlyjkcJ/kEWPBSZUqdNe3YkNX13N94mUqPvXJNwWt+2f7jSezYod4erkF5XBRlNkojPw7V0xz4HkieRX19dEt1iIFzL+Zdi3+BoBwGdKZgOAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735887597; c=relaxed/simple; bh=04lNmsNySnVFo9f3O4o4cKfbKTj9UhtSwAYs8oiNvOM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kiRYk2hyJ5ylvjQobU+JHimre1OsrXRd3WpBw0ahpsG3Wil0Tc6m8tLX4cVe9kf5gsfr8zlH6S2Pd9lLPmwjxxsnnAG9LgaNde3x4NYu6Rs0UZXn65tTXCdSnMGuZsob/ffoIMuznuZuCEaHAdMR+j/cvB/6Xkrzsq24eO/JMIU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=Bw9ZgU9z; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="Bw9ZgU9z" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21649a7bcdcso161354745ad.1 for ; Thu, 02 Jan 2025 22:59:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1735887594; x=1736492394; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tUMl/jt9UeNbHuZ/o30GHqr3MzCzR59KrfQ73K3Jzow=; b=Bw9ZgU9zxglG//mPMHvNs2WpV1H9ZNLBaPyZheySFl7gthR4sDag/JjlLEKyGtf+hG lowWATox2wQ+WiT5d0DC7oiPJALddPWKowYSbcNqClGIBcO5t1NrMYhIFCkUr7bhP4rc IQEUxODQiEZcdwV1WzWju2NrSQpQdvnw81u69Bv1RhGgDOEwcd3bAaJHHtgSvQVP8rFT IqQGA8Qugqjwr0Nd3uc7SvPEr5nlHnK10TZpaEKtDFQoMrd1m21eWIfGUM0/CyzVd/4U eO5EPdGpOyFCDaMAvxF0Fu914VMmW4RJerXweE2nmn0thMo4agzXUuvei12QVExzIf9i p7vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735887594; x=1736492394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tUMl/jt9UeNbHuZ/o30GHqr3MzCzR59KrfQ73K3Jzow=; b=HFHaOpDdeJfSSx9cG5HjX+dPrqErTDZe6tYEJz4kGy3cA56rXqtfz2GRDiFX1m7WFs jJsLIepCsRMp1hcz7OBUrJUQfTw/4OL0JhlIiRYsx2cR+D5jZIAY4suii0pn7Mt9rjW0 OClqfDrgebycOTA7Qz24EwN01Jxn43XmSofK/og+uoJBqpuN3vJj4oeXvm9wbbABlLni YTSwMIODxOx+mNCOaQhy/qT0kUAQkMELZK6KCiH8kI0X2XQPPAWCHr2IVrhamWojj9rd FokXP1jclUbomykKCtSYK6oORdlJ60/GBnbn0djzx2B7GLM/9Nr/2vpCYBLv+HlvmXaW e2WQ== X-Forwarded-Encrypted: i=1; AJvYcCWox80aQvhoOPT/Z24Ddm27np3unhcyfCAq3mDnRwakNiRXNo+/JPmzC0m7L4IsclL1dfaWmaOlveagKrc=@vger.kernel.org X-Gm-Message-State: AOJu0YzFelw2xaRFomJbk2Z2N2k4PcNSu7VBIPLTnJ4saNBWNdL4uqDK +3WCC+QOjDlYXLx5RAXYAhaqXpXKqdDJJf56knW3D8NskZPd1ruifqXxcnYCmzM= X-Gm-Gg: ASbGncs8a2hqPasUHtavpPzpbYFXTD+n3Ja1MiCeBccZtgFOdubFAqiLHL/HJ1om9WE 81NuotC6MWJQg0w1a9Pe/oBTzWPoVf1SdH6QAX0WBDEv5brstGzSXl3MkEKQ0iHn1YCbe92oNsZ 3BJzik9jTWDInPu1Y19eOHOoLNn+HErNkG13nonM4GqecOShXzH0HjiFZGVKURrNwgUB8z8lEGo xOE4GH5CL5sgZh9qHB7MptNJL1N5kmuynoFEIal8bc1ZvWDtRnUvyh53c9XH9PeGEOuqTWZYGIx X-Google-Smtp-Source: AGHT+IEZ23nYFmqi4FmHpOi3oCdY8Zks+Xzu7vN8ylV7n7PoqALklYP9zENSNb+2GvGRl9ocqjUjzQ== X-Received: by 2002:a17:903:238b:b0:216:39fa:5cb4 with SMTP id d9443c01a7336-219e6eb6234mr717609335ad.25.1735887594548; Thu, 02 Jan 2025 22:59:54 -0800 (PST) Received: from n37-019-243.byted.org ([180.184.84.173]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9631d1sm238456235ad.42.2025.01.02.22.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 22:59:54 -0800 (PST) From: Chuyi Zhou To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, longman@redhat.com, riel@surriel.com Cc: chengming.zhou@linux.dev, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, Chuyi Zhou Subject: [PATCH v2 3/3] sched/fair: Ensure select housekeeping cpus in task_numa_find_cpu Date: Fri, 3 Jan 2025 14:59:30 +0800 Message-Id: <20250103065930.413464-4-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20250103065930.413464-1-zhouchuyi@bytedance.com> References: <20250103065930.413464-1-zhouchuyi@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Now in task_numa_find_cpu(), we only skip CPUs that are not in the task's cpumask, which could result in migrating the task to an isolated domain if the task's cpumask includes isolated CPUs. This is because cpuset configured partitions are always reflected in each member task's cpumask. However, for isolcpus=3D kernel command line option, the isolated CPUs are simply omitted from sched_domains without further restrictions on tasks' cpumasks. This change replaces the set of CPUs allowed to migrate the task from p->cpus_ptr by the intersection of p->cpus_ptr and housekeeping_cpumask(HK_TYPE_DOMAIN). Signed-off-by: Chuyi Zhou --- kernel/sched/fair.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a0139659fe7a..05782b563609 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2081,6 +2081,12 @@ numa_type numa_classify(unsigned int imbalance_pct, return node_fully_busy; } =20 +static inline bool numa_migrate_test_cpu(struct task_struct *p, int cpu) +{ + return cpumask_test_cpu(cpu, p->cpus_ptr) && + housekeeping_cpu(cpu, HK_TYPE_DOMAIN); +} + #ifdef CONFIG_SCHED_SMT /* Forward declarations of select_idle_sibling helpers */ static inline bool test_idle_cores(int cpu); @@ -2168,7 +2174,7 @@ static void task_numa_assign(struct task_numa_env *en= v, /* Find alternative idle CPU. */ for_each_cpu_wrap(cpu, cpumask_of_node(env->dst_nid), start + 1) { if (cpu =3D=3D env->best_cpu || !idle_cpu(cpu) || - !cpumask_test_cpu(cpu, env->p->cpus_ptr)) { + !numa_migrate_test_cpu(env->p, cpu)) { continue; } =20 @@ -2480,7 +2486,7 @@ static void task_numa_find_cpu(struct task_numa_env *= env, =20 for_each_cpu(cpu, cpumask_of_node(env->dst_nid)) { /* Skip this CPU if the source task cannot migrate */ - if (!cpumask_test_cpu(cpu, env->p->cpus_ptr)) + if (!numa_migrate_test_cpu(env->p, cpu)) continue; =20 env->dst_cpu =3D cpu; --=20 2.20.1