From nobody Mon Jun 15 00:12:35 2026 Received: from canpmsgout11.his.huawei.com (canpmsgout11.his.huawei.com [113.46.200.226]) (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 85547379999 for ; Tue, 7 Apr 2026 06:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775542333; cv=none; b=bhMFnPnCZ4AM5GsQch8hLB4Nt/nsMm3YQTWSm3SVkX3Tj/NedEMd6qXKj+jZ4vsW/v3AAA6LHEnhQb3tjCumYmUrJ6eONSB7HN1+vlmM1YNVh9tDiMrpX4FYUngZdyR695baNk5C5O83kA+lTVb8nXnDqgCENQ2VuMKbTeeO5wo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775542333; c=relaxed/simple; bh=9QLyV1s1uH0BY7MXQIcGKSSmtEqDMf5sjE/tFWtzqug=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=cBHD7QoYH69MNNxNXhFmMy5r7pJNZYmQgrjYX8TjjI4fOpsZIx+QmuAW13FPjXkBXzrAnLG656zi1FRWU63+GEuyZdfblzmEptSbLvbv4D63x0ABevUllUfY157d8n+W6XDa9+Vp8Z0AGY/Eac1vAdtRLEzv+1t2ZrERWC4qJ44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=r2SKpFSG; arc=none smtp.client-ip=113.46.200.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="r2SKpFSG" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=99U5wTDsOYhAhzsRSxA4kQkg+C2SxelATy7fhJVNJII=; b=r2SKpFSGVUUn2+kD8La1zqgXGppgPmy8Fd0s+QyPlySjYolGtFFBZ+YsfMBw4ICeeIVkzulTx 8+/32aX+xiCJ73jtm/SR9FGLWZGH4IGv5sevBgEqI4j6E06dL85ezT9SCAp14ZLZmi59YWkIG1z mw6ePxuPFEpZNmPsknAmDc8= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4fqbKX0yrtzKmWD; Tue, 7 Apr 2026 14:05:52 +0800 (CST) Received: from dggpemf100017.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id 6282C40562; Tue, 7 Apr 2026 14:12:07 +0800 (CST) Received: from huawei.com (10.67.174.191) by dggpemf100017.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 7 Apr 2026 14:12:06 +0800 From: Zhang Qiao To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , CC: , Subject: [RFC PATCH] sched/fair: scale wake_wide() threshold by SMT width Date: Tue, 7 Apr 2026 14:39:15 +0800 Message-ID: <20260407063915.2034198-1-zhangqiao22@huawei.com> X-Mailer: git-send-email 2.18.0.huawei.25 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To dggpemf100017.china.huawei.com (7.185.36.74) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" wake_wide() uses sd_llc_size as the spreading threshold to detect wide waker/wakee relationships and to disable wake_affine() for those cases. On SMT systems, sd_llc_size counts logical CPUs rather than physical cores. This inflates the wake_wide() threshold, allowing wake_affine() to pack more tasks into one LLC domain than the actual compute capacity of its physical cores can sustain. The resulting SMT interference may cost more than the cache-locality benefit wake_affine() intends to gain. Scale the factor by the SMT width of the current CPU so that it approximates the number of independent physical cores in the LLC domain, making wake_wide() more likely to kick in before SMT interference becomes significant. On non-SMT systems the SMT width is 1 and behaviour is unchanged. Signed-off-by: Zhang Qiao --- kernel/sched/fair.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f07df8987a5ef..4896582c6e904 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7334,6 +7334,11 @@ static int wake_wide(struct task_struct *p) unsigned int slave =3D p->wakee_flips; int factor =3D __this_cpu_read(sd_llc_size); =20 + /* Scale factor to physical-core count to account for SMT interference. */ + if (sched_smt_active()) + factor =3D DIV_ROUND_UP(factor, + cpumask_weight(cpu_smt_mask(smp_processor_id()))); + if (master < slave) swap(master, slave); if (slave < factor || master < slave * factor) --=20 2.18.0