From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 927831DDC33 for ; Fri, 13 Mar 2026 02:30:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773369030; cv=none; b=NFogx6HVXYlVNLelBQ0giKoOjYo7uaQ5AZYZk/tlr+OiNVyYV67mY7hsDjemaBTtluiSYH4Kz4t6oJiaoOymA4l010DA0IMRgF7fhcCtNpLFuNQVtk17Ft0wSeuGFASLC03/iQHYTSczJGcBM+ximnlUvOkLzkBagwuLRl025LU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773369030; c=relaxed/simple; bh=d2Lc7ZGlox1ZPiPfQoq/fxotJSL+zXhlm9fDzt3ahKo=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=C7kiorUhcdlDPXV6SH6eXQd4HWAWN/lh5Na5QnNJX+fg9HW8LF13ywDzCtInJuRZzm1+a0FJh5Ju+wGFIkNVN1s/6NFEv7BwJB2AIFzJnpU/7t1jjeB97ips0ltR9jndrtNAjlKaXhFdrZswNx0GpfVdMaQ0Gw+q+xOp8bxXI3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=MwSlFW8c; arc=none smtp.client-ip=209.85.214.202 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.b="MwSlFW8c" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2ae4af66f40so18666355ad.1 for ; Thu, 12 Mar 2026 19:30:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1773369026; x=1773973826; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=o2trwWlM/ODEAOezTVHj5+0tYH+HYnMKqWHTk97vJuM=; b=MwSlFW8cbRascSnwOmO9Ss/5ymiWY1jBFkahJP9/nJ1SEPexX1/KVZNhLPwPDOttGd OhKMUuGiEzs69EyNn643hHGBqsfrURX7Vgq8WPFnq62iCoI7ckoiclutADnxKrAM1MNV kShqxZoBq2/6nUoQlZy/AyyXAuow+f2nW1oWcqvKQl5Xw2RzufOb31CrOqRrRfulTYn8 loBPChMi8jEQ9cIRbfmy+2esD7h/q+kcZMhPF5grLP540t0/EiMyjhiOLFeEq5wyUpr3 13HNqZ30bCJmh4NEgBrCws7EvgKuzuxITL5dvgwmKLmiDo9jXwcfu6Os7+6vgW4Cvf9+ Bfug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773369026; x=1773973826; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o2trwWlM/ODEAOezTVHj5+0tYH+HYnMKqWHTk97vJuM=; b=C2vlk/Fv/3l0UYQfIszjtz7bWLq5fpoO8oelTM+whODQzy8hj+mUMqolbcIxsor2bM 0XayV+KZTkOlImzw8oLZ2/Dv6iR05cQAcfe4yA5P9XEOojLAzRfUsd81Wb0YuWc4mkjq RLe4EsbX/589QhHsJ8pLJeJsx5nrg1pwtQoPli8rII4NUW42r0ltzl/JPuN1lz7glKuB Y/2h+s3HMWNhOqN+eEf5qlL4z3H/qUBxDyCfykvyHkrQNHgImUJs36tqRnIz5UzHb1B9 PCDClLhOZBXVYKchGEKmsWcSEEik8mlQfyFKBuTOFwkDLzYVArSFMhX9AdWp2uoRan3N v/6w== X-Gm-Message-State: AOJu0YwuulTp49hwBpgzXaieSVONIrZrQBcISz52BIzxfJhupJzfxFEh MbVOsCnQBtxpYPUoXjlMTr7X5yAfrca/Vrkr05+JZW9KMbKwGclTX437/uJ7+yb+fepljxAQMB2 2wEnxxTzoid9g8Vs8efajXP2t3A9K2GtVjwdd9MDKnMlInbd+XXZyt3wLEqvSrZ0uHkdQlqM/k9 f5dS7PFKGYkQIQpKpF4ZWjufz1/sNFqjwVh23cM1VbEHZOOQFk X-Received: from plhy12.prod.google.com ([2002:a17:902:d64c:b0:2ae:bfa7:672e]) (user=jstultz job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:2ec7:b0:2ae:c67c:3b05 with SMTP id d9443c01a7336-2aeca8ec2b6mr13944115ad.10.1773369025466; Thu, 12 Mar 2026 19:30:25 -0700 (PDT) Date: Fri, 13 Mar 2026 02:30:01 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.880.g73c4285caa-goog Message-ID: <20260313023022.2902479-1-jstultz@google.com> Subject: [PATCH v25 0/9] Simple Donor Migration for Proxy Execution From: John Stultz To: LKML Cc: John Stultz , Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Mel Gorman , Will Deacon , Waiman Long , Boqun Feng , "Paul E. McKenney" , Metin Kaya , Xuewen Yan , K Prateek Nayak , Thomas Gleixner , Daniel Lezcano , Suleiman Souhlal , kuyo chang , hupu , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey All, Yet another iteration on the next chunk of the Proxy Exec series: Simple Donor Migration This is just the next step for Proxy Execution, to allow us to migrate blocked donors across runqueues to boost remote lock owners. As always, I=E2=80=99m trying to submit this larger work in smallish digestible pieces, so in this portion of the series, I=E2=80=99m only submitting for review and consideration some recent fixups, and the logic that allows us to do donor(blocked waiter) migration, which requires some additional changes to locking and extra state tracking to ensure we don=E2=80=99t accidentally run a migrated donor on a cpu it isn=E2=80=99t affined to, as well as some extra handling to deal with balance callback state that needs to be reset when we decide to pick a different task after doing donor migration. Much of the new logic in this version is thanks to K Prateek, who provided a lot of insightful suggestions to the v24 series! New in this iteration: * With additional changes, the previous full Donor Migration series had gotten pretty long, so to go easy on reviewers I=E2=80=99ve dropped the later Donor Migration patches I had in v24, which basically provided optimizations so try_to_wake_up() would do return-migration, smarter mutex handoffs, and proxy migrating the entire chain in one pass. K Prateek also had some suggestions for further improvements in these later patches that I have not yet addressed, so for now I=E2=80=99m going to table them and will revisit once progress is made with this set. * Fix for proxy_tag_curr() erroneously leaving tasks off of the pushable list, reported by K Prateek and suggested by Peter, allowing us to drop the proxy_tag_curr() logic completely. * Peter noted compilers don=E2=80=99t always optimize as we would like, and suggested reworked logic to reduce repetitive sched_proxy_exec() branches. * Rework of proxy_force_return() suggested by K Prateek to use WF_TTWU flags, and to use attach_one_task() helper to simplify code. * Other small cleanups through the series suggested by K Prateek. I=E2=80=99d love to get further feedback on any place where these patches are confusing, or could use additional clarifications. There=E2=80=99s also been some further improvements In the full Proxy Execution series: * David Stevens reported and diagnosed an issue with loadavg being incorrect due to incorrect nr_uninterruptible accounting in the sleeping-owner handling.=20 * An issue with rwsem support was found and fixed, along with other simplifications to the changes. * Fix suggested by Peter for an edge case with DL adding tasks twice to the pushable list when Proxy Exec pushes the donor task. * K Prateek had further suggestions to improve the optimized donor migration changes, dropping the unnecessary migration_node addition to the task_struct, and using atttach_tasks to simplify the full chain migration. * Tiffany Yang pointed out some unnecessary CONFIG_SMP bits were still lingering and could be cleaned up. * An initial draft at Documentation update to describe Proxy Execution. I=E2=80=99d appreciate any testing or comments that folks have with the full set! You can find the full Proxy Exec series here: https://github.com/johnstultz-work/linux-dev/commits/proxy-exec-v25-7.0-r= c3/ https://github.com/johnstultz-work/linux-dev.git proxy-exec-v25-7.0-rc3 Issues still to address with the full series: * Resolve a regression in the later optimized donor-migration changes combined with =E2=80=9CFix 'stuck' dl_server=E2=80=9D change in 6= .19 * With the full series against 7.0-rc3, when doing heavy stress testing, I=E2=80=99m occasionally hitting crashes due to null return from __pick_eevdf(). Need to dig on this and find why it doesn=E2=80=99t happen against 6.18 * Try to integrate and rework K Prateek=E2=80=99s suggestions for the later optimized donor-migration changes. * Continue working to get sched_ext to be ok with Proxy Execution enabled. * Reevaluate performance regression K Prateek Nayak found with the full series. * 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: Figuring out pi-futexes would be good, using proxy for Binder PI is something else we=E2=80=99re exploring. * Eventually: Work to replace rt_mutexes and get things happy with PREEMPT_RT I=E2=80=99d really appreciate any feedback or review thoughts on the full series as well. I=E2=80=99m trying to keep the chunks small, reviewable and iteratively testable, but if you have any suggestions on how to improve the larger series, I=E2=80=99m all ears. Credit/Disclaimer: =E2=80=94-------------------- As always, this Proxy Execution series has a long history with lots of developers that deserve credit: 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 and Suleiman Souhlal 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: Joel Fernandes Cc: Qais Yousef Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Valentin Schneider Cc: Steven Rostedt Cc: Ben Segall Cc: Zimuzo Ezeozue Cc: Mel Gorman Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: "Paul E. McKenney" Cc: Metin Kaya Cc: Xuewen Yan Cc: K Prateek Nayak Cc: Thomas Gleixner Cc: Daniel Lezcano Cc: Suleiman Souhlal Cc: kuyo chang Cc: hupu Cc: kernel-team@android.com John Stultz (9): sched: Make class_schedulers avoid pushing current, and get rid of proxy_tag_curr() sched: Minimise repeated sched_proxy_exec() checking locking: Add task::blocked_lock to serialize blocked_on state sched: Fix modifying donor->blocked on without proper locking sched/locking: Add special p->blocked_on=3D=3DPROXY_WAKING value for prox= y return-migration sched: Add assert_balance_callbacks_empty helper sched: Add logic to zap balance callbacks if we pick again sched: Move attach_one_task and attach_task helpers to sched.h sched: Handle blocked-waiter migration (and return migration) include/linux/sched.h | 91 +++++++---- init/init_task.c | 1 + kernel/fork.c | 1 + kernel/locking/mutex-debug.c | 4 +- kernel/locking/mutex.c | 40 +++-- kernel/locking/mutex.h | 6 + kernel/locking/ww_mutex.h | 16 +- kernel/sched/core.c | 300 +++++++++++++++++++++++++++++------ kernel/sched/deadline.c | 16 +- kernel/sched/fair.c | 26 --- kernel/sched/rt.c | 15 +- kernel/sched/sched.h | 35 +++- 12 files changed, 414 insertions(+), 137 deletions(-) --=20 2.53.0.880.g73c4285caa-goog