From nobody Mon Jun 8 07:24:35 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 911EF3C6A5C; Thu, 4 Jun 2026 18:45:40 +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=1780598742; cv=none; b=Ho91cu7FPo6GtUo/8UBtPgQU/qE4GMPCzB6CWuoUtHJ9Hmxw7PILMoNV5oj4YLJChg1V9KYMh8tal65o5+K873mKXFiK/0z69Zya5Q8U6jqsfjhoe5AwOMEbogKLFvg//hjhk3jpxMX1RmCzgV9XV5PZKbSt5N3eDp6FI6Ayc/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780598742; c=relaxed/simple; bh=FBX7n6+Z/YakJbC8GyXfqKnprpipiPEDyqIb1tv0xXo=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=GWQ8EgxObIqpvamYWBEZ+Lqy7GtrQHwUZDZ9eo4ovXx5KbdVW2LWLFUL+YFK9fyqGyuHBX0VAoXzgetldT+cRfcgtnpMKgRn/1oPlvMQSVlRZ7KTiaD+ojXMjxEXb0HbB2EPfsx8C7Fox0rL0YGj8DI7JcOUJ87CxPJ6zPVEgps= 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=us18kOfI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=X57Nx2DJ; 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="us18kOfI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="X57Nx2DJ" Date: Thu, 04 Jun 2026 18:45:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780598739; 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=anyzD+PK5zHeb2s5rAtr2+pwXGHe9us96bBlFPHaSM0=; b=us18kOfIf9R8aHbKqbXFqB6T00GgsU/MXSMTF7dImOuuAkjfW4LM+lmWwlCmOZVDPhzxQg PB1blH3LPTcJam6X9+0dkVY6Fxb3yCdSQxkY2Z1QAxDu/DKarBIaclQQUaqTlsOjpxZKP+ 2OmMrgYVFqj8QMfAT6KhTn+GKXyxAWVOU+xq7BqPV1rFFo+gSBI2dZkXDvy4cFTJTeSpLD R9hptmJPE09xazFbKiCA8lpxx+/0NK83NDTTlvHY4SuYjZt9KbsEv+C8QdwlSTEAvZvZzv 9mTG9z5LsAus4eIHSbUqnxG0iu3uPNDVx9JRzKyXeZPu+LxDGephNrnnKl6B/Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780598739; 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=anyzD+PK5zHeb2s5rAtr2+pwXGHe9us96bBlFPHaSM0=; b=X57Nx2DJSytZbMEVzBhdooMPUDyyamsr+R3QvZWvxJ3o/GDcHz/9xvJdu2AbvT2FE226ZU foI3Fj5PwSaq3GBw== 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/proxy: Remove PROXY_WAKING Cc: K Prateek Nayak , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260526113322.596522894@infradead.org> References: <20260526113322.596522894@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178059873790.710.12277659765538688771.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: ec9d4f1c424134bbf30965075df78d02a5d021dc Gitweb: https://git.kernel.org/tip/ec9d4f1c424134bbf30965075df78d02a= 5d021dc Author: K Prateek Nayak AuthorDate: Tue, 26 May 2026 11:43:02 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 02 Jun 2026 12:26:09 +02:00 sched/proxy: Remove PROXY_WAKING Now that the proxy path uses ->is_blocked, use the '->is_blocked && !->blocked_on' state instead of PROXY_WAKING. Notably, this is where a blocked_on relation is broken but the donor task might still need a return migration. Signed-off-by: K Prateek Nayak Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260526113322.596522894%40infradead.org --- include/linux/sched.h | 50 +------------------------------------- kernel/locking/mutex.c | 4 +-- kernel/locking/ww_mutex.h | 4 +-- kernel/sched/core.c | 2 +- 4 files changed, 7 insertions(+), 53 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index e2f127a..35e6183 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2205,19 +2205,10 @@ extern int __cond_resched_rwlock_write(rwlock_t *lo= ck) __must_hold(lock); =20 #ifndef CONFIG_PREEMPT_RT =20 -/* - * With proxy exec, if a task has been proxy-migrated, it may be a donor - * on a cpu that it can't actually run on. Thus we need a special state - * to denote that the task is being woken, but that it needs to be - * evaluated for return-migration before it is run. So if the task is - * blocked_on PROXY_WAKING, return migrate it before running it. - */ -#define PROXY_WAKING ((struct mutex *)(-1L)) - static inline struct mutex *__get_task_blocked_on(struct task_struct *p) { lockdep_assert_held_once(&p->blocked_lock); - return p->blocked_on =3D=3D PROXY_WAKING ? NULL : p->blocked_on; + return p->blocked_on; } =20 static inline void __set_task_blocked_on(struct task_struct *p, struct mut= ex *m) @@ -2245,7 +2236,7 @@ static inline void __clear_task_blocked_on(struct tas= k_struct *p, struct mutex * * blocked_on relationships, but make sure we are not * clearing the relationship with a different lock. */ - WARN_ON_ONCE(m && p->blocked_on && p->blocked_on !=3D m && p->blocked_on = !=3D PROXY_WAKING); + WARN_ON_ONCE(m && p->blocked_on && p->blocked_on !=3D m); p->blocked_on =3D NULL; } =20 @@ -2254,35 +2245,6 @@ static inline void clear_task_blocked_on(struct task= _struct *p, struct mutex *m) guard(raw_spinlock_irqsave)(&p->blocked_lock); __clear_task_blocked_on(p, m); } - -static inline void __set_task_blocked_on_waking(struct task_struct *p, str= uct mutex *m) -{ - /* Currently we serialize blocked_on under the task::blocked_lock */ - lockdep_assert_held_once(&p->blocked_lock); - - if (!sched_proxy_exec()) { - __clear_task_blocked_on(p, m); - return; - } - - /* Don't set PROXY_WAKING if blocked_on was already cleared */ - if (!p->blocked_on) - return; - /* - * There may be cases where we set PROXY_WAKING on tasks that were - * already set to waking, but make sure we are not changing - * the relationship with a different lock. - */ - WARN_ON_ONCE(m && p->blocked_on !=3D m && p->blocked_on !=3D PROXY_WAKING= ); - p->blocked_on =3D PROXY_WAKING; -} - -static inline void set_task_blocked_on_waking(struct task_struct *p, struc= t mutex *m) -{ - guard(raw_spinlock_irqsave)(&p->blocked_lock); - __set_task_blocked_on_waking(p, m); -} - #else static inline void __clear_task_blocked_on(struct task_struct *p, struct r= t_mutex *m) { @@ -2291,14 +2253,6 @@ static inline void __clear_task_blocked_on(struct ta= sk_struct *p, struct rt_mute static inline void clear_task_blocked_on(struct task_struct *p, struct rt_= mutex *m) { } - -static inline void __set_task_blocked_on_waking(struct task_struct *p, str= uct rt_mutex *m) -{ -} - -static inline void set_task_blocked_on_waking(struct task_struct *p, struc= t rt_mutex *m) -{ -} #endif /* !CONFIG_PREEMPT_RT */ =20 static __always_inline bool need_resched(void) diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c index 2867716..89d01f7 100644 --- a/kernel/locking/mutex.c +++ b/kernel/locking/mutex.c @@ -1044,7 +1044,7 @@ static noinline void __sched __mutex_unlock_slowpath(= struct mutex *lock, unsigne next_lock =3D __get_task_blocked_on(donor); if (next_lock =3D=3D lock) { next =3D get_task_struct(donor); - __set_task_blocked_on_waking(donor, next_lock); + __clear_task_blocked_on(next, lock); current->blocked_donor =3D NULL; } raw_spin_unlock(&donor->blocked_lock); @@ -1060,7 +1060,7 @@ static noinline void __sched __mutex_unlock_slowpath(= struct mutex *lock, unsigne =20 raw_spin_lock_nested(&next->blocked_lock, SINGLE_DEPTH_NESTING); debug_mutex_wake_waiter(lock, waiter); - __set_task_blocked_on_waking(next, lock); + __clear_task_blocked_on(next, lock); raw_spin_unlock(&next->blocked_lock); =20 } diff --git a/kernel/locking/ww_mutex.h b/kernel/locking/ww_mutex.h index 6c12452..d62b49b 100644 --- a/kernel/locking/ww_mutex.h +++ b/kernel/locking/ww_mutex.h @@ -324,7 +324,7 @@ __ww_mutex_die(struct MUTEX *lock, struct MUTEX_WAITER = *waiter, * blocked_on to PROXY_WAKING. Otherwise we can see * circular blocked_on relationships that can't resolve. */ - set_task_blocked_on_waking(waiter->task, lock); + clear_task_blocked_on(waiter->task, lock); wake_q_add(wake_q, waiter->task); } =20 @@ -383,7 +383,7 @@ static bool __ww_mutex_wound(struct MUTEX *lock, * are waking the mutex owner, who may be currently * blocked on a different mutex. */ - set_task_blocked_on_waking(owner, NULL); + clear_task_blocked_on(owner, NULL); wake_q_add(wake_q, owner); } return true; diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9b71031..cec2c16 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6872,7 +6872,7 @@ find_proxy_task(struct rq *rq, struct task_struct *do= nor, struct rq_flags *rf) for (p =3D donor; p->is_blocked; p =3D owner) { /* if its PROXY_WAKING, do return migration or run if current */ struct mutex *mutex =3D p->blocked_on; - if (!mutex || mutex =3D=3D PROXY_WAKING) { + if (!mutex) { clear_task_blocked_on(p, mutex); if (task_current(rq, p)) { p->is_blocked =3D 0;