Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.215.197 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796183571; b=hsKAgxfhiBf5eevT8SuSogSzSGSWd1IkLOPHcEaUKktjKTTARCjwdByXrTRIXMpJVQxg u7KN2UYBdQTwN8KAAHIWfVAEVW7NORWbUSqZojAv+HGuFtW98BPdn+37+Ezlu5vxPfNaP PvtVa+xxajtTyDI24fjnJkxQ79PiRKbvA1vnpbmCSkR4ap4FwyLC/qmBxLAA0ZFojmH/7 rwrK/qBT2FDumuEX2Xa2SVxvPo1r9gLgYbHs0vJtFAmB583ERzS/f3ywVVkPB8eAN5ocw Pdl28IHURTArMD8OfZzZIWZCMBi+LcgD7Ro+/UzlryhqM3fypoLMivaNwqVLvxlfw+A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796183571; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Received:Date:Mime-Version:X-Mailer:Message-ID: Subject:From:To:Cc:Content-Type:Content-Transfer-Encoding; bh=UB3OW3r9oaDi79yBByQotaztxvZxsRYVKkn7eOhDHpE=; b=fRo0v6qmfEsc8lzGdDmunyhpDBkretjF0wL4fKRuEch3jPEUbsCKeuq8Q9uBb3ndDvu7 otWlWUtKWaleEdUfsgVB2rv1ddMBw7xZpBBtMOHzv3vA9PyOZnGuIYRHnon6wc1bXxAxb bkWepfrod3dr9Qa5QYrBklTNPomL6kzjXHxPfDm12xbUfXc/o5qFUuZcFs1mg95bFWcQz Xrj7hU8cOhIJrFyCdjQyjOGCWOxYdcQ0waR/rU9PB6wyUi+0/Z7LnJrqJeSCZHk3hTw04 61Prtd4QXIZr5YV+hJ3e9QrPNf9XKtxg1WcgClFfgOA4MdamWswdy8KMBXWsKF2Jsng== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b="FsB/hu0a"; arc=none smtp.remote-ip=209.85.215.197 Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D07A606A31A for ; Wed, 2 Dec 2026 03:52:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4D07A606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=FsB/hu0a Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-cdb869327e7so9872865a12.0 for ; Tue, 01 Dec 2026 19:52:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796183570; x=1796788370; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:mime-version:date:from:to:cc:subject:date:message-id :reply-to:content-type; bh=UB3OW3r9oaDi79yBByQotaztxvZxsRYVKkn7eOhDHpE=; b=FsB/hu0aygKuocEG+LU2ObJJ9EwWvEI6MYV+FmQAJ+byo6I5yj/0SFzMV48UD1xKNt wNj2OrBMmbbrUGMsF3PH8sQX8yQoZKELWzb9PjuP8DtPvvPg9d3ZRBdoercoMleh7E9W aDrcDBH9Vq4EQBFT93INmz+U8a6j3jwz3A3t1XTrHDXWD9zp5JDs9CdeoCmBS1VRxwrT f56WTFTJMlzJ3g21FsCsF0W3wBJTqWPPZXKRtdBvOCt6Q7Idc+CwKOARL3JHLdAufiD/ 0aB9p6i3tPzD8RypVX/hlCe4P2+9vzZ2PMsPEAx+JBJpqt5bD+/wwDQ/9xvy95xhpboN WApg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796183570; x=1796788370; h=content-transfer-encoding:content-type:cc:to:from:subject :message-id:mime-version:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=UB3OW3r9oaDi79yBByQotaztxvZxsRYVKkn7eOhDHpE=; b=MLU+M7uof3cwv/52k0N8p1b35WpJJmqxPumMel9DtpFPGVrrpeEhbtnfZdDixY73cS QDm3P8JQGikISk7f9s/r+QswfFAHaJ314puRun0w9w26De3J8DEA6oC6DH9aSWI/qAxN FvYK+sEfJtTKk4bPoTtigWWqKsRmUuPkpb7AuU1kCks4bMZjrBvj+lL9S7eXedudung6 CpVsQTU5a5hA2dwvzseky/Tt5GCjsDenfImcoW0f6oSYSegDdBIULdp8lv2r//kKk35y FMjJ0aqH7J8EzZJPO71HOVIBeOJvHEvwNtaLznJ2ZXfSj8NgTEHFIijGPhFw1sFqNiQO br8g== X-Gm-Message-State: APuU4Z8DWTulEuFW6Hg/0h/GOZcdyjalMv/YBB1FEqNoolYE7TIo22Bu 35IRgBBOVtr3Wdne9a5PRpox7iy7qVdJmGsrgRXWBnjdl9kDGbFZc4NVhpnOqnCv7C/ruMGN1MY Yf+LEBDseUnnwDqJ/fRkeefpEfKeBZOXK/yudj1MH6ntCCe5DtaD/J88zVB9w8KL0kgSGh68CmW 8ndY6oA5RbbUAjoaiToZypEOkELyA5L1ev7RIWdpBCIglK2nG3 X-Received: from pllh10.prod.google.com ([2002:a17:902:748a:b0:2f0:c1cb:c627]) (user=jstultz job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:41c2:b0:2dd:b795:9cb6 with SMTP id d9443c01a7336-2f03f1cfad8mr425126935ad.21.1796183569976; Tue, 01 Dec 2026 19:52:49 -0800 (PST) Date: Wed, 2 Dec 2026 03:52:28 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261202035248.1210026-1-jstultz@google.com> Subject: [PATCH v34 00/14] Sleeping Owner Handling for Proxy Execution (v34) From: John Stultz To: LKML Cc: John Stultz , Peter Zijlstra , Ingo Molnar , K Prateek Nayak , Thomas Gleixner , Juri Lelli , Vincent Guittot , Valentin Schneider , Suleiman Souhlal , Andrea Righi , Johannes Weiner , Metin Kaya , Dietmar Eggemann , Steven Rostedt , Zimuzo Ezeozue , Waiman Long , Boqun Feng , "Paul E. McKenney" , Joel Fernandes , Qais Yousef , Xuewen Yan , kuyo chang , hupu , Zhan Xusheng , "zhidao su (Xiaomi)" , Hui Su , "Shubhang Kaushik (Ampere)" , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey All, Just wanted to send out this next iteration of Proxy Execution: Sleeping Owner Handling. Unfortunately it=E2=80=99s been an unexpectedly busy time since LPC and I just haven=E2=80=99t had much time until right before the long weekend to try to respond and address all the great feedback that has been shared. My apologies, I really do appreciate all the feedback and suggestions! The good news is that during this time, there were a lot of practical proxy related issues uncovered and fixed, so those items (which applied to this portion of the series or upstream) are included here.=20 (Folks may remember back in the heady days of September w/ v32 of the series, where this chunk was only 2 patches! Fond memories!). Peter: Even if the full set submitted here isn=E2=80=99t queued, it likely would be good to take some of the earlier fixups in this set if you don=E2=80=99t have objections to them. Let me know if there=E2= =80=99s a better way for me to queue and handle fixes vs features to send to you. As always, I=E2=80=99m trying to submit this larger work in smallish digestible pieces. A quick overview of the journey so far: 1) Prep patches 2) Single rq proxying 3) Simple donor migration 4) Optimized donor migration 5) Sleeping owner handling <-- We are here! 6) K Prateek=E2=80=99s core-sched fixes 7) Chain level balancing 8) Suleiman=E2=80=99s proxy rwsems 9) Suleiman=E2=80=99s proxy futexes 10) ... On top of a number of correctness fixes, the main feature in this series is the sleeping owner handling patch, which addresses what to do when a task is blocked on a mutex whose owner is sleeping. Since there is nothing we can do to boost the sleeping owner at that point, we instead deactivate and queue the waiter on a list attached to the owner. Then when the owner wakes up, we will activate the waiters on the same runqueue, so they can then boost the owner to run. But since the simple sounding things hide subtlety, this ends up being a pretty complex bit of logic. You can effectively get trees of waiters, and it's possible to have tasks in the middle of the tree be woken up. Then handling wakeups as they cascade down the tree properly is also a bit complex, as there are extra lists to manage the recursive style work without actually recursing. In this series I=E2=80=99ve also aggregated fixes from K Prateek, Shubhang Kaushik, as well as included some initial proxy-chain cycle detection logic combining parallel efforts from Zhidao Su and Hui Su. Additional fixes from Mathieu Desnoyers, Yu-Ting Tseng, as well as ones suggested by Andrea Righi, K Prateek Nayak and Juri Lelli are included this time. Further, I=E2=80=99ve folded a number of fixes suggested by Jichao, Andrea, Kayra, and K Prateek into the sleeping-owner-enqueuing change. Again, thank you to everyone for contributing bug reports, fixes and improvements! I really appreciate it! New in v34 of this set: * Improvements to PSI fix suggested by K Prateek * Fixes for proxy edge cases with DL and RT tasks from Mathieu Desnoyers * Fixes for the blocked_donor back-pointer handling from Mathieu Desnoyers * Along with other fixes inspired by Mathieu raising blocked_donor issues * Further care around lock cycle avoidance with blocked_donor traversal (preparation for future proxy futex logic, where userland may intentionally create cycles) * A proxy migration correctness issue, where we weren=E2=80=99t calling migrate_task_rq(), found and fixed by Yu-Ting Tseng. * Fixes to an issue Andrea Righi raised on the find_proxy_task() task_current() shortcuts skipping important logic done in the wakeup path for core scheduling. * Fixes to the find_proxy_task() lock-cycle deactivation logic to avoid deactivating current * Fix to sleeping owner handling to avoid re-activating TASK_DEAD tasks, found and suggested by Jichao Zou * Fix to sleeping owner handling=E2=80=99s do_activate_blocked_watier() logic to take blocked_lock earlier address a race K Prateek pointed out. * Change to pass DEQUEUE_SPECIAL to block_task() in proxy_enqueue_on_owner() to fix issue Kaya and Andrea raised with sched_delayed tasks * Only call activate_blocked_tasks() if the task was actually woken, as suggested by Andrea and Kaya * A new fix to migrate_task_rq_dl() issue that Andrea raised, as suggested by K Prateek and Juri * Fix for a RCU / proxy-exec deadlock discovered by Yu-Che Cheng.=20 * As well as lots of smaller polish issues suggested by K Prateek, Andrea and Kaya. Additionally I=E2=80=99d appreciate any testing or comments that folks have with the full Proxy Execution series! You can find the full Proxy Exec series here: https://github.com/johnstultz-work/linux-dev/commits/proxy-exec-v34-7.4-r= c5 https://github.com/johnstultz-work/linux-dev.git proxy-exec-v34-7.4-rc5 New changes to the full patch series in this revision include: * Number of cycle avoidance changes to the chain-migration logic. * Fix for a crash issue in chain-migration logic reported and fixed by Yu-Ting Tseng * blocked_donor pointer handling fixes in proxy-rwsem logic, related to blocked_donor issues Mathieu raised in this set. Issues still to address with the full series: * Need to polish and fold down changes in the full series, as my focus on this chunk of the set I=E2=80=99m submitting for review has left the rest of the series a little messy. * Beyond the migrate_task_rq() correctness issue, Yu-Ting Tseng found some issues with PELT handling with proxy-exec that I=E2=80=99m evaluating how to best fix. * Need to update and include Suleiman=E2=80=99s latest Proxy enabled futexes series, which fixes a lot of recently uncovered edge cases. * Maria Yu raised a subtle difference in how the nr_iowait counting might be attributed with proxy-exec: potentially proxy-migrated donors that become blocked on sleeping owners could increment/decrement the value on the owners cpu rq, instead of on the donor=E2=80=99s original cpu rq. It=E2=80=99s unclear t= o me what the impact of this would be, if at all, but it is potentially an observable difference with proxy-exec, so I=E2=80=99m going to take a swing at addressing it. * Reevaluate performance regression K Prateek Nayak found with the full series earlier. * The chain migration functionality needs further iterations and better validation to ensure it truly maintains the RT/DL load balancing invariants (despite this being broken in vanilla upstream with RT_PUSH_IPI currently) Future work: * Expand to more locking primitives: Binder PI is something else we=E2=80=99re exploring. * Eventually: Work to replace rt_mutexes and get things happy with PREEMPT_RT Credit/Disclaimer: =E2=80=94-------------------- As always, this Proxy Execution series has a long history with lots of developers that deserve credit:=20 First described in a paper[1] by Watkins, Straub, Niehaus, then from patches from Peter Zijlstra, extended with lots of work by Juri Lelli, Valentin Schneider, and Connor O'Brien. (and thank you to Steven Rostedt for providing additional details here!). Thanks also to Joel Fernandes, Dietmar Eggemann, Metin Kaya, K Prateek Nayak, Suleiman Souhlal, Christian Loehle, and Andrea Righi for their substantial review, suggestion, and patch contributions. So again, many thanks to those above, as all the credit for this series really is due to them - while the mistakes are surely mine. Thanks so much! -john [1] https://static.lwn.net/images/conf/rtlws11/papers/proc/p38.pdf Cc: Peter Zijlstra Cc: Ingo Molnar Cc: K Prateek Nayak Cc: Thomas Gleixner Cc: Juri Lelli Cc: Vincent Guittot Cc: Valentin Schneider Cc: Suleiman Souhlal Cc: Andrea Righi Cc: Johannes Weiner Cc: Metin Kaya Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Zimuzo Ezeozue Cc: Waiman Long Cc: Boqun Feng Cc: "Paul E. McKenney" Cc: Joel Fernandes Cc: Qais Yousef Cc: Xuewen Yan Cc: kuyo chang Cc: hupu Cc: Zhan Xusheng Cc: zhidao su (Xiaomi) Cc: Hui Su Cc: Shubhang Kaushik (Ampere) Cc: kernel-team@android.com Hui Su (1): sched/proxy: Detect cycles in proxy walks earlier John Stultz (5): sched/psi: Preserve sleep-persistent PSI flags on off-CPU sleeping dequeues sched/mutex: Use READ_ONCE/WRITE_ONCE for concurrent blocked_donor accesses sched/proxy: Avoid transient blocked_donor cycles sched/deadline: Try to handle dl bandwidth properly with proxy blocked-waiter activations rcu-tasks: Treat proxy-exec blocked tasks as voluntary sleeps K Prateek Nayak (1): sched/core: Activate blocked donor when no owner is found Mathieu Desnoyers (3): sched/proxy: Reschedule when a blocked task is woken under a proxy sched/proxy: Wake blocked RT and deadline tasks through the full path sched/proxy: Clear blocked_donor when the donor stops donating Peter Zijlstra (1): sched/proxy: Add deactivated (sleeping) owner handling to find_proxy_task() Shubhang Kaushik (Ampere) (1): sched/core: Use the scheduling context for remote ticks Yu-Ting Tseng (1): sched/proxy: Invoke migrate_task_rq() on proxy-migration zhidao su (Xiaomi) (1): sched/proxy: Break cyclic proxy chains by deactivating blocked tasks include/linux/sched.h | 7 + include/linux/sched/task.h | 1 + init/init_task.c | 6 + kernel/fork.c | 6 + kernel/locking/mutex.c | 4 +- kernel/rcu/tasks.h | 45 ++-- kernel/sched/core.c | 527 ++++++++++++++++++++++++++++++++----- kernel/sched/deadline.c | 14 +- kernel/sched/stats.h | 28 +- 9 files changed, 547 insertions(+), 91 deletions(-) --=20 2.56.1.911.g883d8bcb20-goog