From nobody Mon Jun 8 07:24:33 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 CD0883C1F24; Thu, 4 Jun 2026 18:45:28 +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=1780598730; cv=none; b=JE3w7827Y2OdnCtquNALoDc+KGfNDzlNG+dfZMXlLAyoSJNLV25RXQPsM6DDFODWi5DDFsE62FSmNpiX1bWeC2QgJv7pLiSFQOZW60DudD1NH98lqq52FoIP2UoJ3zWGEyYhepsFYspX0Z212EyejwZDg5ePo/kr3sWsULaDuRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780598730; c=relaxed/simple; bh=NwW18iIGG5ntTVKNceIlH8x1jgy2neZbgswqS/khMzU=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Gn6CJ2Ayz8tTd0PCG9qnteG1rgo6fqUZMhJHF9ciWt8QDzluEfKIW5Q9Xbtbguk9JK6r8Og2VAL2g+kA2DXxrRNmkUsMMwTCZikspeYRErG20oEvoAOHRUZQhWwRiaVDMtZZf/NdtDllTfw1Krvwvefo+4yoyODNgf6P6R4ZHAU= 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=3Q6QRtCu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=UCUc3Et1; 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="3Q6QRtCu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UCUc3Et1" Date: Thu, 04 Jun 2026 18:45:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780598727; 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=tDKbJyzBwV4eAeTl36u7VZ1gCSg1jK+GA/hmlhraMzk=; b=3Q6QRtCuu2akJpX2vxJnQ1u+WthOG58X3zIpyzSXasnzCv2InkCihMdm11AvamswTr59fU LUE0xHN6Ue67cyhN5eMokVKLTtJipaB7NJLsdFhe5VFBlgHfTWAlJT+0JarRAIah8yJ11T 549uF7Ur8bQ8xnb1maHWM/CINn0WsXfilNdVEvsGCwU3lXEw3EC05YX3kN3uLH1bq6aRLf Yik9SCEWdZiW1y1dM3Iv9ycjy+lcKTr9whA7oNytUGlr2fKl2BMrQ+Sfz5WrDykqYjXq4K /KNFMi4bakOJBvYiI7Cw1BrK+ft5bCi8ose2ElfgHRXKsC6yF+W5krGAg9Zx8g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780598727; 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=tDKbJyzBwV4eAeTl36u7VZ1gCSg1jK+GA/hmlhraMzk=; b=UCUc3Et1oygMMCiJj+ZYE/Iuj+YLyTlIKedLzFeVPbdYp+ZXWy+b0Q0A+aSoCXJ81VJf49 OluTUkOTLFkb88CQ== From: "tip-bot2 for K Prateek Nayak" 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: Use throttled_csd_list for local unthrottle Cc: K Prateek Nayak , "Peter Zijlstra (Intel)" , Benjamin Segall , Aaron Lu , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260602050005.11160-3-kprateek.nayak@amd.com> References: <20260602050005.11160-3-kprateek.nayak@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178059872549.710.9641795834404322935.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: 253edcf5436c916f2fbf7b880443c7f1ed76101d Gitweb: https://git.kernel.org/tip/253edcf5436c916f2fbf7b880443c7f1e= d76101d Author: K Prateek Nayak AuthorDate: Tue, 02 Jun 2026 05:00:02=20 Committer: Peter Zijlstra CommitterDate: Tue, 02 Jun 2026 12:26:12 +02:00 sched/fair: Use throttled_csd_list for local unthrottle When distribute_cfs_runtime() encounters a local cfs_rq, it adds it to a local list and unthrottles it at the end, when it is done unthrottling other cfs_rq(s) on cfs_b->throttled_cfs_rq until the bandwidth runs out. Instead of using a local list, reuse the local CPU's rq->throttled_csd_list and the __cfsb_csd_unthrottle() path for unthrottle. If this is the first cfs_rq to be queued on the "throttled_csd_list", it prevents the need for a remote CPUs to interrupt this local CPU if they themselves are performing async unthrottle. If this is not the first cfs_rq on the list, there is an async unthrottle operation pending on this local CPU and the unthrottle can be batched together. No functional changes intended. Signed-off-by: K Prateek Nayak Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Benjamin Segall Tested-by: Aaron Lu Link: https://patch.msgid.link/20260602050005.11160-3-kprateek.nayak@amd.com --- kernel/sched/fair.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 261e5ce..26a8bbb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6991,12 +6991,11 @@ static void unthrottle_cfs_rq_async(struct cfs_rq *= cfs_rq) =20 static bool distribute_cfs_runtime(struct cfs_bandwidth *cfs_b) { + bool throttled =3D false, unthrottle_local =3D false; int this_cpu =3D smp_processor_id(); u64 runtime, remaining =3D 1; - bool throttled =3D false; - struct cfs_rq *cfs_rq, *tmp; + struct cfs_rq *cfs_rq; struct rq *rq; - LIST_HEAD(local_unthrottle); =20 guard(rcu)(); =20 @@ -7047,24 +7046,23 @@ static bool distribute_cfs_runtime(struct cfs_bandw= idth *cfs_b) } =20 /* - * We currently only expect to be unthrottling - * a single cfs_rq locally. + * Allow a parallel async unthrottle to unthrottle + * this cfs_rq too via __cfsb_csd_unthrottle(). + * If we are first, do it ourselves at the end and + * save on an IPI from remote CPUs. */ - WARN_ON_ONCE(!list_empty(&local_unthrottle)); - list_add_tail(&cfs_rq->throttled_csd_list, &local_unthrottle); + unthrottle_local =3D list_empty(&rq->cfsb_csd_list); + list_add_tail(&cfs_rq->throttled_csd_list, &rq->cfsb_csd_list); } =20 - list_for_each_entry_safe(cfs_rq, tmp, &local_unthrottle, - throttled_csd_list) { - struct rq *rq =3D rq_of(cfs_rq); - - guard(rq_lock_irqsave)(rq); - - list_del_init(&cfs_rq->throttled_csd_list); - if (cfs_rq_throttled(cfs_rq)) - unthrottle_cfs_rq(cfs_rq); + if (unthrottle_local) { + /* + * Protect against an IPI that is also trying to flush + * the unthrottled cfs_rq(s) from this CPU's csd_list. + */ + scoped_guard(irqsave) + __cfsb_csd_unthrottle(cpu_rq(this_cpu)); } - WARN_ON_ONCE(!list_empty(&local_unthrottle)); =20 return throttled; }