From nobody Mon May 25 00:09:08 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 8423832B109; Wed, 20 May 2026 08:34:11 +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=1779266052; cv=none; b=pOF3rpsZ7kaVQBSTRCKFyDaqTGamZNZhKFH/8WfFBD0jGnS3/wvUoAGg5Z7IL32TDqYGUYKFNVWedXHHFh6sOGLKoxusj3nR/lkYI4uQDfyDsEtg6jNRZ7GKQV9mnTLuYpaGnShfxwn+tiMyUOfQwts2xBVxGOysEme1sKD7Crw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779266052; c=relaxed/simple; bh=NsGyAnD+3JUiKwc4RKEkXKAEqhXbzmR/HzJGysf36jo=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Z7rGEVDhtXq+n1YkbL0Pg5RWFJ/dYSCnc/MI8/9jyHAt/MD+5IrXiDkuIddjChTyIdIUKyz+YITfz6Rr56dQjL8+/VOFXcdafiywXZl3Wo9L4jIuzLwE4B5GVinrCJdT9sI5aYY8VKaYHKY85Jl3zNvJpfy45Qc1XUOJn9h/gio= 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=GPTbOiwA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=K9pNTzZy; 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="GPTbOiwA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="K9pNTzZy" Date: Wed, 20 May 2026 08:34:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1779266050; 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=jAs41yZk6YbymZkhOeD/lUO14Djw3dwrwPa/Q5xeOfA=; b=GPTbOiwAVD2tsmywCxDiF2RH9Q5ZsVptcZ3kH+z6mpKr3WdxU63qGiuOvS3xgY98TZdW/f l+4OE8qktDgPir4449DFf1mBSgQIL0iX9YCdhqdkV73ke8SZAZPbZwiEqmCAUoQOMsfzWN ZjXgf1z5o2RsCWK7XkT0EykzcRwmF8MFuwnJodgzEcLYZZ9c8Z6wUYTH2SZNV2KZcMEquI vv36dijwVmPfM7uoRtB4VWaI//8poNh0Cl15yvji2HPQeej92ZqQBKeU9N4SmwII/aXO51 i0rFH3pexOOZilSpGvzbSv3GBFI3O02UJ5opQoqxY/iS5YZ4LRKW9jSSatpIRw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1779266050; 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=jAs41yZk6YbymZkhOeD/lUO14Djw3dwrwPa/Q5xeOfA=; b=K9pNTzZyBpEG0CkbsOZgiAQAR8m6RHLnKNWgx6M4LaU/mYNNUFZpaDB8ZoETlQkFro0AXh WNK84JlvcVL6J7Dg== From: "tip-bot2 for Shrikanth Hegde" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Add sched_smt_active check for fastpaths Cc: K Prateek Nayak , Shrikanth Hegde , "Peter Zijlstra (Intel)" , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260515172456.542799-4-sshegde@linux.ibm.com> References: <20260515172456.542799-4-sshegde@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177926604872.711.3095257781308885355.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: 3dbb362f90f3a8300ed9209d3278e30f8dbfb780 Gitweb: https://git.kernel.org/tip/3dbb362f90f3a8300ed9209d3278e30f8= dbfb780 Author: Shrikanth Hegde AuthorDate: Fri, 15 May 2026 22:54:55 +05:30 Committer: Peter Zijlstra CommitterDate: Tue, 19 May 2026 12:17:37 +02:00 sched/fair: Add sched_smt_active check for fastpaths For fastpaths such as wakeup and load balance even minimal code additions can add up. is_core_idle is accessed during load balance. Other callsites of is_core_idle make sched_smt_active() check first. Make the same check in should_we_balance. Rest of access to cpu_smt_mask isn't in fastpath. Note: Remove the stale comment above is_core_idle. Enqueue methods of fair aren't close to it anymore. Suggested-by: K Prateek Nayak Signed-off-by: Shrikanth Hegde Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://patch.msgid.link/20260515172456.542799-4-sshegde@linux.ibm.com --- kernel/sched/fair.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 233bd2e..14bd31b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1549,10 +1549,7 @@ update_stats_curr_start(struct cfs_rq *cfs_rq, struc= t sched_entity *se) se->exec_start =3D rq_clock_task(rq_of(cfs_rq)); } =20 -/************************************************** - * Scheduling class queueing methods: - */ - +/* Check sched_smt_active before calling this to avoid overheads in fastpa= ths */ static inline bool is_core_idle(int cpu) { int sibling; @@ -11961,7 +11958,9 @@ static int should_we_balance(struct lb_env *env) * balancing cores, but remember the first idle SMT CPU for * later consideration. Find CPU on an idle core first. */ - if (!(env->sd->flags & SD_SHARE_CPUCAPACITY) && !is_core_idle(cpu)) { + if (sched_smt_active() && + !(env->sd->flags & SD_SHARE_CPUCAPACITY) && + !is_core_idle(cpu)) { if (idle_smt =3D=3D -1) idle_smt =3D cpu; /*