From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.221.43 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796194770; b=e/qWkvgdfw2U3i9G8M1YgamY5tIRg6wMXX+54iRDuoGyavb4W+Ny/FlgnLioH3sw8lnD 0vO0lLUsnoqbu1x/eq/pgItv4yyFs8z1nvGoXPIMTd/LMlFFUsaJk7ObCX5UbBt7pPQf7 0hsQyDzJmZkrZ950xQ+5fmdEL4q2OzWkvBbSNVLaS0FY93Uh6EP9FfEAA1r/fVihgwURu TGZWt946zFHdHWZZVMG8RWpeviUyH4MosGrVFTMbVTdx+xzOOK2qdNkuGLODrFmSCpE8u n/dbat/zzgxyTsLLZRilFx/dwTkZxlK1lAckcgmrnOT0LJ1PDy+5huzB2vEiwjkv0Fw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796194770; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:MIME-Version:References: In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc: Content-Type:Content-Transfer-Encoding; bh=PiZYEGLUoAihW+QVCxHj8s0rIwucSIWBMbEzTLnhX9s=; b=PDs5+cErC6H7YB8m/elLu6o3LwYkc6j0MhcYAeETSU0MdIkB8hTKWmZghodip7wQ1AgJ oobh8/HA/j7Km27TR9P1XX8M8djk6GcIjAM2eFqC6a6nBzlbjrDnZOGnUDUrAkGTlKSEo kp+5zDnvPlC7/mEfBeYFtFYw3wMz+iYNhcScpQMNqB1Ps//Nd2dbSFx/fGXavlDtWvthb mjYB45PjyQA4DnLf/3wil5lwDctWmP4m85t2P0FZCb7+ZbPHWctIlw+zbE+WUKLVM4OMt CaVDhhRvAfEAX+UpBAsd0jP6sJknu3s46ViU1RN4Ub5U0l/K0xOyAw1FTLmG9WldAaQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=QADF6emg; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.221.43 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 6D293606A31A for ; Wed, 2 Dec 2026 06:59:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6D293606A31A 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=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=QADF6emg Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4c84abcb7bdso1395778f8f.1 for ; Tue, 01 Dec 2026 22:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1796194769; cv=none; d=google.com; s=arc-20260327; b=cnPFLkJ1sXxKK0he3IHkxMvoereAcB6M88Auw+wJ9rzlY6nS4EVShcdD9wtOkDq1Nl LTqy13xZ1mkciVxniL9MO4FVtUPCcLYvLHqWluQL2allSxUyeHPtzRRVCajXebvvqW/u Zra55IVdGhxQKbBrLDyzeaammoUpz989KgHWXxEJaRDKdP6rnEqSPn+NdjKw+9FatbOX CGeUoJUxmuHZm3biI5myOyiJs0560yM63jt8ExmXONebQD1knNcCsop7LeWUnCXYECIo SbRD31hJWOM2xUt9zrUs9UtdbLkecHPXsYhU8eX6rKPQ88uzbh3MFm+3Ck++fTdlcWsr IaZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PiZYEGLUoAihW+QVCxHj8s0rIwucSIWBMbEzTLnhX9s=; fh=aU2Rm3+i6qMFCjHJkRKVu/Aoe0t1aGKgnk1UyDoERwY=; b=dTkzXWGvk5QA9kH44uUXtgMSdMuP9bmLbIoqqTlAs+Z629ehwfzlYN3T/Vop1mjaaN yshj3nVMmI0n2Rwf5m+Lv2omY+VZU9sA/tPA1jZudhGEIecYOOrA2qoA/CanRWVzFxmY 6opH7a36/U6XftOcWLI+MkBvbNBwhMQZRc89BVRw9os48+DaqNhpMPUNngKasUDdxiL2 oHsZN7dvw4NKkmXtJsG+vPBzjrhxv6pOS8ZmwbY9C8qbp53dccK+nI9S0sc/UFlHI3l7 ziaSAg0yKkEdDbBUuT+B5nA1ZzEoO4fgXTM8D9cazNx5KedHyKZaBD1aSI5P+9GTyMiP /AUw==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796194769; x=1796799569; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=PiZYEGLUoAihW+QVCxHj8s0rIwucSIWBMbEzTLnhX9s=; b=QADF6emgTUYUl4x1SQjoVW2Hy0ySWejWcOajeMsPCK9bdPeE+s7cQaHer5i1dHE+6f e/k5JIQtNmLv7cimKHhzcWeMVZcBkenkaw5J+dsxuhcViESYvHKjc7tDp2AV9y2BdH2l ZpjI1EyBa1jHzBZrs+kiC9Lhv0pTUKh07zVakLiab9lqBKM3nRggWNgaR/waYPCxxunC vKbvAF9wiPJ8pYH/P6WimsxcKQ2o8mTdkmQSsPeFOo4Wz+LfsODEWsoAEkMxQKhSHg7m 1vDJ+3z/p+XYZog9qFdXHiL+SsJtw91+6P3fDQMiIzO3K7RRogE1uJnnfHoNjp3qDWyf pGXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796194769; x=1796799569; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=PiZYEGLUoAihW+QVCxHj8s0rIwucSIWBMbEzTLnhX9s=; b=h7kG3W2UESQj4c+1i7jZp7OmFzJUUAQqgGMydxVDMlxBfJ/JpAHUi3A3s5q7zohKi9 /j4ssdqyIhd6tJpmrfevw0ueSWLAbk/SntUgZPew/W89L4uKs66gbXDtGIRBxLw3vjE+ NOIq0b8gYB3pQppqRQ79PgVfAeWKwppBNMtHp9t1STuuxefQIBIIEIdxwY7Z/zbAnbNL M0rZf41rGkNYkgwyaMsYl8aFO175ujy8JQflXDBY+PcQGjy6RTgww4v/qPb4djti6c6B LcGxFYKvpMDnbX9Ze4J3RUKk0ULRt7vGagm7W/JAC6kOjhl08jaWJjqZesmaqnEkeUbe HUyA== X-Gm-Message-State: APuU4Z9FMSq3ZiitEMdummQ3vnC9cqNCmSWyu4a92MFX57GUn8RCzF4i QyYrc+b2djUDCtPUHfxq7ZFHn8OdlIz4dhZ6I99aeR1Xgn0FHhfN1WZPQ/vlnxI38Wanupqw9vd 3wHiNHAi2nc/CrtyVfv7VuZJeK1x9ttt+vbB7g2A= X-Gm-Gg: AZFdTZcuCv5tQ64pX0HYnmTWuXhb7tOzvudo1N3O6C0+9MCXAzo8FQ5ctn69OxZlQ51 0sqG/9zhL0/xu3ZDYgBvM9s1YmEYcZtjXcNlXaIq8pKFO59uXIbjcuo8pBlEGeLKyRP0tW0l6pp szV96ClpQT8otAzLERyPxmgmMT96OjcjD/Z2VAWAsSYuR8gycvkwNmOF9sRWaOgrhYopQBTPghI H1/4Q4k/c2dtPAywB64d6HJk0YhTJuIWd+XF3aO9mk72dgyNnt0nyYqr5WpRrJmY0BVHVj60fH4 U714oI03E5b46Iz4UQ2JJVIoh6PsjTbv4bMD3r4yptm7+9xinTaahm6c3dxYrDT76CSmYCJ33w1 XqdL3OvSIGJTipKxkTIWRtxGavYoLXcZzc1hHqlbhoAvt0MsROkVSam4bvLx0e+af+m9tw0j3qN l/qZSsJuU0pOL5upALNAQc3hxLNYzz9a1e8BnnuLpwAU8xMqKc6wzDsgu3DBIWs8XufI5IlUJzS KvlXL76xw9mlxq0BCwl+xYM4LFZVNHDgE4ognjwRbngWnz/Ihso X-Received: by 2002:a05:6000:40c9:b0:4b4:510c:519e with SMTP id ffacd0b85a97d-4bdfa714d92mr38752749f8f.27.1796194768345; Tue, 01 Dec 2026 22:59:28 -0800 (PST) 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 References: <20261202035248.1210026-1-jstultz@google.com> <20261202035248.1210026-8-jstultz@google.com> <5034ed73-911d-4212-b78f-39b1b845a1aa@amd.com> In-Reply-To: <5034ed73-911d-4212-b78f-39b1b845a1aa@amd.com> From: John Stultz Date: Tue, 1 Dec 2026 22:59:15 -0800 X-Gm-Features: Aa3M54rZpuha0rVJ1DWAwdUMrTDnrnfL_PmRi1kPzYKLypQqfdk3rCGXtWUbgis Message-ID: Subject: Re: [PATCH v34 07/14] sched/proxy: Avoid transient blocked_donor cycles To: K Prateek Nayak Cc: LKML , Peter Zijlstra , Ingo Molnar , 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 On Tue, Dec 1, 2026 at 10:29=E2=80=AFPM K Prateek Nayak wrote: > On 12/2/2026 9:22 AM, John Stultz wrote: > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > index 17871c8a5ab30..6a9fec7a26f67 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -7050,7 +7050,11 @@ static void proxy_migrate_task(struct rq *rq, st= ruct rq_flags *rf, > > * before we release the lock. > > */ > > proxy_resched_idle(rq); > > - for (; p; p =3D READ_ONCE(p->blocked_donor)) { > > + while (p && task_on_rq_queued(p)) { > > + struct task_struct *next =3D READ_ONCE(p->blocked_donor); > > + > > + /* clear blocked_donor so we can't end up in cycles */ > > + WRITE_ONCE(p->blocked_donor, NULL); > > Ooo! Interesting. I suppose this is still needed with Patch 10 and 11 > because a ww_mutex unlock can suddenly clear a cycle before the > Brent checkpoint can converge but the backwards link are already > cyclic? So less likely to be mutex related, this came up as a issue with the proxy-enabled futexes Suleiman is working on, as if userspace controls the locks, they can create lots of odd looking cycles (including stuff like locking a lock they already own, or maliciously locking it with another task's tid who then tries to lock the lock). So while we have to be careful in the main find_proxy_task(), we also have to be careful elsewhere where we walk chains to guard against infinitely looping (the later chain migration patches in the series also had a few spots like this to address). Additionally, with the other stale blocked_donor issues that had been found, this seemed like a good place to zap them, since the primary uses of blocked_donor is to go a single step back (rq->curr->blocked_donor) when handing locks off, and the proxy_migrate_task() optimization to migrate the full chain in one go. So clearing it as we go in the migration function seemed like a good step to avoid mistakes. thanks -john