From nobody Fri Feb 13 00:21:34 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 9E1CC1BD504 for ; Fri, 3 Jan 2025 06:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735887592; cv=none; b=SpbW+ADV/Z8B4FrIF+5pMDxCbMzXLUAk78zD7IyEgVYfFW/PxGcOJol6c8d7DVw+9wFE9IYHU6m9R80YiiG0DwTsl6x1IVBrKfr+S/a8xVgZU6xj121d06v+hC3+vqJWRj9sCG7dn3o2IjfNCbubdwYlceRpvyyCCvinbOHX+Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735887592; c=relaxed/simple; bh=SuISuTxchex9RJodo04tat69zEAGe+ko1/0ZQdMXDUU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MEBHCokA99vSsdFHD9Po6CBsP3Uo7B07Xh/9sueUf67w9DAo2+mQmy83PD08WjH9+tVy0zy/Ed+rDKS7IoRwEHms7YUPr/nzbr9A6oeyzsFOIIjwTe5w+GYOqZ2Oy87z3pHknCcF4TTVZCzPnxHjMFal3BLTO0VXk8ha71UOq+U= 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=aQxslQDD; arc=none smtp.client-ip=209.85.214.169 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="aQxslQDD" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2163dc5155fso162840275ad.0 for ; Thu, 02 Jan 2025 22:59:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1735887590; x=1736492390; 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=KKG7eYUurdAiRXTeQw3+Dl2PfUcHaffYGwgJSL+ktjo=; b=aQxslQDDQRcjQ7iJMmnZE33jd6b7Myh4t3zTQt8Ib7BFCu6CdHN+2dcGgP0uQmMjyG EqyVz4UtX9s/DhDessbNf4fcfS471fwm3BeJlZdEPxUob26lsVqPY4eZUz/DjeTCvW+5 jw31R4Mla/zQqKX+PXkG+9wWZ4+Y18kuDf706BiV1kldbYcpbOKAGUapTSuKLwvWVEn7 abduiZ3JL2Te6roYpZfaUUc/gADyHTy3ozwBeng0xOkw4ncdt1TkTjqgUIQZf1zlNfyi /mGAVtZ1z2YNF2a+Ls+5VcUaSQKuJUg3s1RaWfhQCznR/N6vb0HvjkWTJeQ8dZP0wNRm GNIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735887590; x=1736492390; 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=KKG7eYUurdAiRXTeQw3+Dl2PfUcHaffYGwgJSL+ktjo=; b=GshHOzyuJnLPxh8I0v56qjEYj8sntw8cND3h9k889bu+bh4tsp51js/d3IEXk+ZtPT AZ+bA296YCQab/0kXozHE5tewJ5QIbsXKQkV7gFyfTtnVvgkNs0Atmk7dV1qI2UOnayJ 6LBz+51wiKAsnalKZpGTuYqAUm+lSF50m4qTbvpBGrRrKTQOjtgJjQOm5hJ9sgGr+sPw lanZ20yBGeQdxxxYIvrwsUWILwg4tA4VNVBuXTCsOpmVr+rjcg0u+cw9sBJzb+FwL1l3 9xlFyFpc/770P7efEE2X9Zs9lkIh2kanSwJRcfje2hCNPMKShOg27GyqT8TkFHFWFGj7 QBgw== X-Forwarded-Encrypted: i=1; AJvYcCWcbl1nq4xTllqnkfUjSLK8Eghbdhsm5pkNHcIjOGD2yg5rb4b9pr7eyISgJ+CvqK6xIXAeU6nmb0DHKoI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+S57bChLtmSnRqbBdOyCYx0mklcMfcHx9xG9zBFOem1wrs6lV UBB0JUbgPQmL4fhiV6hR0idaGDnSIREVo+Rq8wIpa1QrIS8KUMy2NxgevKba7NA= X-Gm-Gg: ASbGncuR7HrIZR50rHttpJ6m4cJytCAX4Qq0AZDxiSZHY88AhSXJj8gvTkTBN2xIXFk qxAQdVIi0frgPhQar0KTB3+zLizvnmLUbXGMlI1luxNRvQCqegPX2z0xJv6XI1AQ/4aduiJSwpS DLpvsNJl7cAXeoNyDIlLR3jtSM/wGNybqsSD0pOcDXwBR3xlmHMoq1AiCEL9PRZNPs6jsYAhrRx ZueRkTxmmYDNgMcPWifvD+hDLo3LeRYEatICNr1jY5+bIVRUBLAPbxI2K4pspEM+lF9Aa3kmNKh X-Google-Smtp-Source: AGHT+IFy+11iMMXujZ9tIzslpzmwO+SFpPDgp38F1xNMmkszZW3EYHGakBzygg6tBclzeHFy8trpBQ== X-Received: by 2002:a17:902:e54e:b0:216:45eb:5e4d with SMTP id d9443c01a7336-219e6e8c529mr692796375ad.6.1735887589934; Thu, 02 Jan 2025 22:59:49 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 22:59:49 -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 2/3] sched/fair: Ignore isolated cpus in update_numa_stat Date: Fri, 3 Jan 2025 14:59:29 +0800 Message-Id: <20250103065930.413464-3-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 update_numa_stats() iterates each cpu in a node to gather load information for the node and attempts to find the idle cpu as a candidate best_cpu within the node. In update_numa_stats() we should take into account the scheduling domain. This is because the "isolcpus" kernel command line option and cpuset iso- late partitions can remove CPUs from load balance. Similar to task wakeup and periodic load balancing, we should not involve isolated CPUs in NUMA balancing. When gathering load information for nodes, we need to ignore the load of isolated CPUs. This change also avoids selecting an isolated CPU as the idle_cpu. Signed-off-by: Chuyi Zhou --- kernel/sched/fair.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f544012b9320..a0139659fe7a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2125,6 +2125,11 @@ static void update_numa_stats(struct task_numa_env *= env, for_each_cpu(cpu, cpumask_of_node(nid)) { struct rq *rq =3D cpu_rq(cpu); =20 + /* skip isolated cpus' load */ + if (!rcu_dereference(rq->sd)) + continue; + + ns->weight++; ns->load +=3D cpu_load(rq); ns->runnable +=3D cpu_runnable(rq); ns->util +=3D cpu_util_cfs(cpu); @@ -2144,8 +2149,6 @@ static void update_numa_stats(struct task_numa_env *e= nv, } rcu_read_unlock(); =20 - ns->weight =3D cpumask_weight(cpumask_of_node(nid)); - ns->node_type =3D numa_classify(env->imbalance_pct, ns); =20 if (idle_core >=3D 0) --=20 2.20.1