From nobody Mon May 25 00:09:07 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 5B2C03DB301; Wed, 20 May 2026 08:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779266094; cv=none; b=cBrMqVv/jKitSL/PsBp7/HqejaoQWxFG8PCKiNfpTtlH+pBXw6WgLhXzBZbN82Y2c6TTmDp2HL8YbSN9HXItcaMQ2M8j2f4qQjG94LDlqvNe+ltQWmvm1fd9EPt7xsm7+wtYNbFFk7dru14SNirsLQJJMh0CbfTluosnc4HcfQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779266094; c=relaxed/simple; bh=YvrKm/Nq2Q3MfxmJi12QxkQ37PClFSMA0dtLSTcvnBY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Y9zza1OqZnMYMTQ2oZAypcsPiCDtOxEbDEg19BrrwjoTYREIUlsOTjqHW7cDxwOkaczzZnkie8vPGWzp8gbHtQpIqLJGKGHQdql7wKm2wGJyp7iRh4HV3E9EVxcLQIRZr6wFXPcyauUWf8XWda/oztfnI9PdNynaW8CxDi32eCQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Gmi3jfU9; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dedypqrm; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Gmi3jfU9"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dedypqrm" Date: Wed, 20 May 2026 08:34:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779266091; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bUY3fOIZb9/YqJYqMF3eS611U9kVOaW4ZUM5Z24phjA=; b=Gmi3jfU9LKXbF4H5ARQksiIK88YMA9L0MMlKKE3H8ft813hva9pbTldhDsWj8j5Y4vSxRC AJjxkK2wsHYzheZ6Yn4zFjOKTCab+QcxknKlZOTY3zThL2KWnNNGX2s8uylqK3XQfwKJvY p6STNzyzNIoC3Boz6C8tufwIgcno8yzGjkPO/Ra8CS12YLw1lZEdGcUF6mIvcW/skqWQ2Z 4vF0LdKayVCczme4ZrT/64+Dosk1kMpXutbi9tKDJ8d9a7uEaKszNAcy2f+UokeoZ50dFE 7HK+eyfgCz60oXpa++gRywXSNYEEPYJBpS3zGSNQeFv/8SFzqBToDjofB25I4w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779266091; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bUY3fOIZb9/YqJYqMF3eS611U9kVOaW4ZUM5Z24phjA=; b=dedypqrmAFW1qC1keKK3OrL9kgHLmyNpHd5+AUXHRqyg6F5iXYv6Fi+xcrCb0ueAubUri1 2OYiIyxdS1s2TKCA== From: "tip-bot2 for Tim Chen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/cache: Check local_group only once in update_sg_lb_stats() Cc: "Peter Zijlstra (Intel)" , Chen Yu , Tim Chen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3C99a57865c8ae1847087a5c00e92d24351cf3e5a8=2E1775065?= =?utf-8?q?312=2Egit=2Etim=2Ec=2Echen=40linux=2Eintel=2Ecom=3E?= References: =?utf-8?q?=3C99a57865c8ae1847087a5c00e92d24351cf3e5a8=2E17750653?= =?utf-8?q?12=2Egit=2Etim=2Ec=2Echen=40linux=2Eintel=2Ecom=3E?= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177926608961.711.17448504638586268362.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/core branch of tip: Commit-ID: 9a5e22fbb0c88bff33458ede98b0fa922fab3831 Gitweb: https://git.kernel.org/tip/9a5e22fbb0c88bff33458ede98b0fa922= fab3831 Author: Tim Chen AuthorDate: Wed, 01 Apr 2026 14:52:23 -07:00 Committer: Peter Zijlstra CommitterDate: Thu, 09 Apr 2026 15:49:50 +02:00 sched/cache: Check local_group only once in update_sg_lb_stats() There is no need to check the local group twice for both group_asym_packing and group_smt_balance. Adjust the code to facilitate future checks for group types (cache-aware load balancing) as well. No functional changes are expected. Suggested-by: Peter Zijlstra (Intel) Co-developed-by: Chen Yu Signed-off-by: Chen Yu Signed-off-by: Tim Chen Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/99a57865c8ae1847087a5c00e92d24351cf3e5a8.177= 5065312.git.tim.c.chen@linux.intel.com --- kernel/sched/fair.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index cea625c..d3812d1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11385,14 +11385,16 @@ static inline void update_sg_lb_stats(struct lb_e= nv *env, =20 sgs->group_weight =3D group->group_weight; =20 - /* Check if dst CPU is idle and preferred to this group */ - if (!local_group && env->idle && sgs->sum_h_nr_running && - sched_group_asym(env, sgs, group)) - sgs->group_asym_packing =3D 1; - - /* Check for loaded SMT group to be balanced to dst CPU */ - if (!local_group && smt_balance(env, sgs, group)) - sgs->group_smt_balance =3D 1; + if (!local_group) { + /* Check if dst CPU is idle and preferred to this group */ + if (env->idle && sgs->sum_h_nr_running && + sched_group_asym(env, sgs, group)) + sgs->group_asym_packing =3D 1; + + /* Check for loaded SMT group to be balanced to dst CPU */ + if (smt_balance(env, sgs, group)) + sgs->group_smt_balance =3D 1; + } =20 sgs->group_type =3D group_classify(env->sd->imbalance_pct, group, sgs); =20