From nobody Thu Apr 2 17:13:12 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 8A11A33AD9E for ; Tue, 10 Feb 2026 22:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770761605; cv=none; b=iTJD6aiU1H7dHrrcgjQbvueP90EjZ28vz3uH683tL7b3dTq666tXjsV4FejCBoJDjAY58TmjuJ4C1TMrWzHDlwr/Z6fwSxvb+uj4SPvMDhyTCwUpQB8TJ5HFQlgqVdfWW7SZp/lUJh+7kddc/A1k+ve0S7pZI2d0BXNzQX3xxww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770761605; c=relaxed/simple; bh=deREQWr008Oddvl6ktaFRrYAHwf1vWih75YBvefoALY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OT13iyB5B9nTFSTN9qBEIFBN7L98adFY/j+VDNLJZIWuP5Ktg8ykP/QguVmZZtXMammdZ4jF784zB9U1Nok2SGOu1hwrzqcMGe8bCHOcidl5sqnzjkwd5dJzfJMX9kVdIz2mvaZ1x+7RjFe4dCZa2YcMnGfqxv6gzA5xAfAYXo4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VQm13UYO; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VQm13UYO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770761605; x=1802297605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=deREQWr008Oddvl6ktaFRrYAHwf1vWih75YBvefoALY=; b=VQm13UYORIFsGskCJRkQeeo2zuRDP/iPPRD6sr5ySXNE6bDCYyKpS1Hl M1poa0FjM2oLwu9SPlXaETXmxM9NIv56Z156uEcjn7GhHVHL20g+VtS5C 1P2DBYVeiC0Hk1ScgDSoVNB+yvk6zvK9BPCH7H8EGkhL1QscTLws074fR MmBB3BN8NLu9nSqXJcD8Zb4BpdIrczEtktD5GMCwqfKl3HlNriBZdgvtv lGsaqZaKnnjEfVhEmIm8FNlItf3OtLrE0psfqp03k3sAJ6OKpcX1k1+2P 7aIN0mVufFES778JO172kYB3Hgt+4ocy31dnv8+F9sm3/MfloU9eEcIvW g==; X-CSE-ConnectionGUID: 23Aou1VYSHqlVg4OjMXmwg== X-CSE-MsgGUID: Ic2QsJqSSMCoisKrkI4ERQ== X-IronPort-AV: E=McAfee;i="6800,10657,11697"; a="82631420" X-IronPort-AV: E=Sophos;i="6.21,283,1763452800"; d="scan'208";a="82631420" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2026 14:13:24 -0800 X-CSE-ConnectionGUID: hUpMd5nNQByyiA1jelrdjw== X-CSE-MsgGUID: XEub+xfKQKKpitoFXSkj/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,283,1763452800"; d="scan'208";a="216373952" Received: from b04f130c83f2.jf.intel.com ([10.165.154.98]) by fmviesa004.fm.intel.com with ESMTP; 10 Feb 2026 14:13:22 -0800 From: Tim Chen To: Peter Zijlstra , Ingo Molnar , K Prateek Nayak , "Gautham R . Shenoy" , Vincent Guittot Cc: Tim Chen , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Madadi Vineeth Reddy , Hillf Danton , Shrikanth Hegde , Jianyong Wu , Yangyu Chen , Tingyin Duan , Vern Hao , Vern Hao , Len Brown , Aubrey Li , Zhao Liu , Chen Yu , Chen Yu , Adam Li , Aaron Lu , Tim Chen , Josh Don , Gavin Guo , Qais Yousef , Libo Chen , linux-kernel@vger.kernel.org Subject: [PATCH v3 10/21] sched/cache: Check local_group only once in update_sg_lb_stats() Date: Tue, 10 Feb 2026 14:18:50 -0800 Message-Id: <9b77a144811f5c11217a0e6a4e6c2b5cfe9dffb9.1770760558.git.tim.c.chen@linux.intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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" 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 --- Notes: v2->v3: No change. 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 bb93cc046d73..b0cf4424d198 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -11109,14 +11109,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 --=20 2.32.0