From nobody Sun Jun 14 15:54:15 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 529BB3B8954; Fri, 3 Apr 2026 12:30:30 +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=1775219431; cv=none; b=RitJ3S2zOLYXv/beqRXnDw9gvuZ4sdR1WjvpUfAXc7roKenoUCyW8+7vIrhmJppcAQ+cgRo8NuMo3asn7KH94ytmZEDmal1VWuyYFPqaCzIXQMEzqD8J0MA7J3iYs35Ck0kxmUU3Y/VhKvy2XCXp6ZKb+Q0kAstWH1ixFsUXMAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775219431; c=relaxed/simple; bh=+mJkMmRDeaU0CppRUXYt26j7OCDzJ3UeO7htpUoyoWE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=hCqgrx1yAtrOgZAcCzfoAmPPYPEet54sVHXjLXRXu4eo9zA5dKRaY+863roVvdZOLVTHnR8v5hHwDjWj2qmJVt90xdoMegvS9WggcE4rEYQYOi6VDzyGmFs86P/UqhcjsL5Wl4oK22n5E4TOmHIYmcREpe/6U9tAtUJVK/y6o4A= 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=J7pafvOp; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BIS5/XzC; 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="J7pafvOp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BIS5/XzC" Date: Fri, 03 Apr 2026 12:30:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1775219428; 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=FS6LBrsjtoJS/GDIBrPwiwo3iiQ47NiOz72K5DHsCJc=; b=J7pafvOp9kuhdn//lQdvaO2p27Af5C7KzyFNzvsz9T7FuQUYjLOfW3SlqkP/QWq4N6izW1 h2whPjIUC7HVWp1xVOjLl0gRYu470w0LV+IOl5PN9R3jR88V5OXzIqHE94u7AOheiAmhFD Bgk/8QSFRec5bin3Old7mPuS/hK8qAsNp8eblqUj7tmhR/vwL9mA/kyEn5hVCfGjffOiYR GFjTcPMEgm+zwFJ/OkX4e9kFdx3PGvHqcE+jQXTAn+mtzECLROU24tFAQAVkKQwqiajGBW Mud1xKrhSjkeBPoILtA71dlsU6eVkDA5k4RRXTYwGDTRo+s8PpbUR6w/lR+PNQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1775219428; 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=FS6LBrsjtoJS/GDIBrPwiwo3iiQ47NiOz72K5DHsCJc=; b=BIS5/XzClEP7zjLykoFA6l/OjLy21pGdAF4w3cKBlpqDq/0wXHtEVH1NH1qHeIzsVRpAsG TDTG50c/Yv0rFsCg== From: "tip-bot2 for John Stultz" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched: Minimise repeated sched_proxy_exec() checking Cc: Peter Zijlstra , John Stultz , K Prateek Nayak , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260324191337.1841376-3-jstultz@google.com> References: <20260324191337.1841376-3-jstultz@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177521942702.1647592.16489002608783755403.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: 37341ec573da7c16fdd45222b1bfb7b421dbdbcb Gitweb: https://git.kernel.org/tip/37341ec573da7c16fdd45222b1bfb7b42= 1dbdbcb Author: John Stultz AuthorDate: Tue, 24 Mar 2026 19:13:17=20 Committer: Peter Zijlstra CommitterDate: Fri, 03 Apr 2026 14:23:38 +02:00 sched: Minimise repeated sched_proxy_exec() checking Peter noted: Compilers are really bad (as in they utterly refuse) optimizing (even when marked with __pure) the static branch things, and will happily emit multiple identical in a row. So pull out the one obvious sched_proxy_exec() branch in __schedule() and remove some of the 'implicit' ones in that path. Suggested-by: Peter Zijlstra Signed-off-by: John Stultz Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: K Prateek Nayak Link: https://patch.msgid.link/20260324191337.1841376-3-jstultz@google.com --- kernel/sched/core.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2974168..f3306d3 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6597,11 +6597,7 @@ find_proxy_task(struct rq *rq, struct task_struct *d= onor, struct rq_flags *rf) struct mutex *mutex; =20 /* Follow blocked_on chain. */ - for (p =3D donor; task_is_blocked(p); p =3D owner) { - mutex =3D p->blocked_on; - /* Something changed in the chain, so pick again */ - if (!mutex) - return NULL; + for (p =3D donor; (mutex =3D p->blocked_on); p =3D owner) { /* * By taking mutex->wait_lock we hold off concurrent mutex_unlock() * and ensure @owner sticks around. @@ -6832,12 +6828,14 @@ pick_again: next =3D pick_next_task(rq, rq->donor, &rf); rq_set_donor(rq, next); rq->next_class =3D next->sched_class; - if (unlikely(task_is_blocked(next))) { - next =3D find_proxy_task(rq, next, &rf); - if (!next) - goto pick_again; - if (next =3D=3D rq->idle) - goto keep_resched; + if (sched_proxy_exec()) { + if (unlikely(next->blocked_on)) { + next =3D find_proxy_task(rq, next, &rf); + if (!next) + goto pick_again; + if (next =3D=3D rq->idle) + goto keep_resched; + } } picked: clear_tsk_need_resched(prev);