From nobody Mon Jun 8 07:24:00 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 362433E16A2; Thu, 4 Jun 2026 18:45:43 +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=1780598744; cv=none; b=dBeXNlTxzN2YF+Iet4VtE4Nm+ZvCllY/QhmcAz5EYzltzblJ+kg6oXSa840jQKxbfdR/CYKUgH1j8RKn6O55Yx9PuhvaQlFsCxJZ01A86Da11+AaFz8qY1cQZ/Yyx64kGqDFRXhFEBJ1QHq3Gfjt1HiTpWT/mYwT3uI+NwP/r1I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780598744; c=relaxed/simple; bh=SlP2Ap4o6UBzXH+tu/uBrf7ykyL8EP7El4JknQkIeEo=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=o0u6ZJauzPEPOjRG/V2S+VSdRNfd9xw4/T/qzuDU2Or74qqV8aM2t9HQs1YgfWx1gejS1tSijSqAdhWNMa5B9ZNJ77cKoKo2Pn6q+n0HYl+nDj1GgQ1w5liWM/Yy3Sq+MLaI7mXuvrAImT8is5OljXQ7JNoeD62l9K827uJAPXI= 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=KAR21JIL; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cnHK7HBF; 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="KAR21JIL"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cnHK7HBF" Date: Thu, 04 Jun 2026 18:45:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780598742; 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=25DpQVgm1VT7BTN8Xl4qHKtMiGFQ5wwUZTWlnFKH8C0=; b=KAR21JILP6zjb5uC+Z5srTKRuKtZoc+XbfGLbk6VlDKYvzY4op2GNaoVGGft/50MDhvfRo yTDlO/bDBaiI6pB84xeIOb1sK6avg1Ln2p8tH9z8IWOMpzgdEVHUDhetOq6CD6D7+7QB+n TxUvCHklbeE2ANWN+4AMkY+SwgnIc/H106im5unAePWIYX6zQpqDYxxul19fLJKOKtHO8T 4LQRO8CQLFvaaLFk+F6s8r1+Zg4RRhxtkmM7pA6pAd7J6rcst8pIO6x61xUWcRUnDVxEom Xp3aqfEIZmRmXGtaMBZUmKdHtZUmDPCJsz1jixmVNUNMxBpVDq9N+sm/cZiUcA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780598742; 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=25DpQVgm1VT7BTN8Xl4qHKtMiGFQ5wwUZTWlnFKH8C0=; b=cnHK7HBFn+HpdqS9d/H/SUWD6mPsT8Q1GMfb+0ovf+KYYcJ2JcQuamSBNyjTF5P4KvcXWs jVxexykUgqL15JCA== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/proxy: Only return migrate when needed Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260527082916.GP3126523@noisy.programming.kicks-ass.net> References: <20260527082916.GP3126523@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178059874054.710.11433637493737217846.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: 7918cf3693614c9f96bc9e43daff6fc72c01b81a Gitweb: https://git.kernel.org/tip/7918cf3693614c9f96bc9e43daff6fc72= c01b81a Author: Peter Zijlstra AuthorDate: Wed, 27 May 2026 09:58:02 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 02 Jun 2026 12:26:08 +02:00 sched/proxy: Only return migrate when needed Current code will 'unconditionally' return migrate on PROXY_WAKING, even if= the task is (still) on the original CPU. Check task_cpu(p) against p->waking_cpu, which per proxy_set_task_cpu() preserves the original CPU the task was on. If they do not mis-match, there= is no need to go through the more expensive wakeup path. Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260527082916.GP3126523%40noisy.programming= .kicks-ass.net --- kernel/sched/core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8b7eb12..b007b65 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3767,6 +3767,21 @@ static inline bool proxy_needs_return(struct rq *rq,= struct task_struct *p) if (!task_is_blocked(p)) return false; =20 + /* + * Typically per __set_task_cpu(), task_cpu(p) =3D=3D p->wake_cpu. + * + * However, proxy_set_task_cpu() is such that it preserves the + * original cpu in p->wake_cpu while migrating p for proxy reasons + * (possibly outside of the allowed p->cpus_ptr). + * + * Furthermore, migration_cpu_stop() / __migrate_swap_task(), will + * only set p->wake_cpu when !p->on_rq, and since here p->on_rq, this + * will not apply. But if it did, this check is the safe way around + * and would migrate. + */ + if (task_cpu(p) =3D=3D p->wake_cpu) + return false; + scoped_guard(raw_spinlock, &p->blocked_lock) { /* Task is waking up; clear any blocked_on relationship */ __clear_task_blocked_on(p, NULL);