From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 6E7A33947B5 for ; Wed, 1 Jul 2026 21:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782942383; cv=none; b=QBCMqMQ4V+Ub64azmSaeYCDAa1+SO0+K6iMNipXyc3jHwImP5crQv777+fmjRT5585d3sN8lC0JsO9wBZcnBb+49h7W6G9BUbf78b/SR7nQRuWNj7wN4lAsCrqsH0zKXBVEAKqY6NJZXSuBPF5TPqwQJHh+5Q0p8/Wo/Mv6DVjc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782942383; c=relaxed/simple; bh=V+d9Upyq/gWwtuophhLgz19JX/FzCVIq/OIMbW1hpQ4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=J07edf1+vHdbt0BwhMg7Hy7gtj17cSV8i9SsJENt7hkUfDjnCLndLSfEqONNu+ov+um1DTWTatFWKyQferjc95ECw1Pe0fAn0kn8/3ThEkOXGRYZJxL2LR/mfF6E6Yn8D5HIyzqKJo2dpSebPl3BcHqZc7yk3sk+otJ/pCpI6ig= 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=t6hGTDWc; arc=none smtp.client-ip=209.85.216.74 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="t6hGTDWc" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-38096521198so1783466a91.3 for ; Wed, 01 Jul 2026 14:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782942381; x=1783547181; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=n3s3n8TR0gjJhYYtaB1hRXLpSk9SFwG0la1ne5HTZpU=; b=t6hGTDWcmbwqvmgR1l/RxiJf/kXm66XMNedlekweYGJKfKxp/giDmSjynTbiS1TIoY LG7SE+34+DUzEkLHYmAmoM1fJOn36X2MgbH0O1hqQomEmQ5lE02mm7up5D2TEfy8KeeK 3sLkwqQHdVxtJNQ5DTbh34dTOyWiVUiQE7pcAxDcoRSMdQ9a2DYPWTjjGYglzwA47uJZ Uhp19iQje4lcFSKM4ut/VUBOXbarxV0TYiaQdqjc3veDkGHgH3KQNrkk5AnadFjAtZlG jD7dKRsHZH/TV+AM/rU26hgYqBgIyOCuLprGZTA65j56JSpR/wd/FF/2B2yTbvdIIc2K stVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782942381; x=1783547181; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=n3s3n8TR0gjJhYYtaB1hRXLpSk9SFwG0la1ne5HTZpU=; b=eL/rcU79ReUbrcMU96BMoJZk7O/bAx2y48xC/9hBgJcJLRcEkv5ZxdTabeifUbpIpX DFW8mx28JmMjNVP5I4p8ZcGmJ8+EmHlxWyX5BWG/gREL+cbvBbNU5gn/GMNBUd3fzQ0r 1EvP54/XiJJ1iFij0Z8jnExBgptteNW22a4hRwV0l3b4p6J8yl6HLopeSd9Lo+lNGce9 xgvJ8SJA+phOKnKQz+TTRw76O9SeoDe7lTActOYooeqrYA2pZZjNZh9BuZ8c+C3qfTT3 /KMUIvuSSit+aRYetpA0eprrwhTDKqi1lN/FBcsJsrBSRbb2S6+KtHrLtnzRxmWQFzLX Nv8g== X-Gm-Message-State: AOJu0YzhemRjIE/IeJzWbefa7gZ5noKg9u1fPfg2nHqNk5Yuh5XUWf5r 6Ie4Eg0h4i3iK7d3GPYq50KU/oT7SoFXsN2OhkifoCZDAXHAnRxCfOi8S/w4I1z9hO+IHyAV0wk WlBqBwRQe9wTlhi125hzByc9+d4GcNDb32Cq54ADGwCYZohtSjVfzivVIsf5KClU8otPdA7KZnj PdttbPMfZLjV7Zm9kQJfsiUZbXMJTtyg4De5C2Mj7cf66plHdt X-Received: from pjtf3.prod.google.com ([2002:a17:90a:c283:b0:37c:9898:a292]) (user=jstultz job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3c4f:b0:37f:c22a:c188 with SMTP id 98e67ed59e1d1-380aa07e1c1mr3526380a91.4.1782942380404; Wed, 01 Jul 2026 14:46:20 -0700 (PDT) Date: Wed, 1 Jul 2026 21:45:58 +0000 In-Reply-To: <20260701214615.3773339-1-jstultz@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260701214615.3773339-1-jstultz@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260701214615.3773339-4-jstultz@google.com> Subject: [PATCH v30 3/7] sched/core: Don't proxy-exec unmatched cookie lock owners From: John Stultz To: LKML Cc: Vasily Gorbik , K Prateek Nayak , John Stultz , Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Will Deacon , Waiman Long , Boqun Feng , "Paul E. McKenney" , Metin Kaya , Xuewen Yan , Thomas Gleixner , Daniel Lezcano , Suleiman Souhlal , kuyo chang , hupu , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" From: Vasily Gorbik Core scheduling chooses a core-wide cookie before __schedule() installs the next task. With proxy-exec enabled, that task becomes the donor/scheduling context, and find_proxy_task() may then replace the execution context with the runnable mutex owner. If its cookie differs from the selected core cookie, running it would bypass core scheduling's cookie selection. When the final mutex owner found by find_proxy_task() does not match the selected core cookie, stop proxying the donor. If the current execution context is already in the blocked chain, fall back to idle like the existing proxy-exec retry paths do. Otherwise deactivate the donor and let __schedule() pick again. The mutex owner can be picked later under its own cookie. Fixes: 7de9d4f94638 ("sched: Start blocked_on chain processing in find_proxy_task()") Reported-by: K Prateek Nayak Link: https://lore.kernel.org/lkml/10282ce9-f4ae-498f-9b57-f4e1e61fffbc@amd.com/ Signed-off-by: Vasily Gorbik [jstultz: Added tweak to ensure we deactivate donor, not runnable owner] Signed-off-by: John Stultz --- 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: 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: Vasily Gorbik Cc: kernel-team@android.com --- kernel/sched/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8e661b5f133d7..36e1db67a8374 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7004,6 +7004,14 @@ find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf) owner->blocked_donor = p; } WARN_ON_ONCE(owner && !owner->on_rq); + + if (owner && !sched_cpu_cookie_match(rq, owner)) { + if (curr_in_chain) + return proxy_resched_idle(rq); + p = donor; /* Deactivate the donor, not the runnable owner */ + clear_task_blocked_on(p, NULL); + goto deactivate; + } return owner; deactivate: -- 2.55.0.rc0.799.gd6f94ed593-goog