From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (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 6116E3A6B8E for ; Fri, 7 Aug 2026 03:52:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786074760; cv=none; b=oD2VuW5LsphZ07MuQNj8hlUt64Ffdj2epXDfJDXgHJo96YurwDAmGrrpotguG+R9qPVkxJ56BZMrhUI/ErZpY+JPneT/mCo+zZUxlwyaxKoX8RIzFMlVEEBhAYTQ129tiQbLDA9I3PTjMDJ1J/rveEZ+YbS/nuYYXDgCdk/XCjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786074760; c=relaxed/simple; bh=DOTE5M8hb/JpZ0fhN/N8sxeueCXjN5uVDpxbKQF6ph8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=cMOTB46QKHQQBK5oY4vQeQoab7opI/Z7CEi0Dq6SCI1ud8R6TeG/wxyCujALzLV5I0PX08FgtXdpj+hr9HfmwuGx73PBFxhUCHo0pAa1wl6aLMz7oGtmD84Gsam/tw4ismjQWKAw6+y8xZPwLp0w0Tu6ewLhzhUb267NNr0X828= 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=WZU3nYue; arc=none smtp.client-ip=209.85.215.199 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="WZU3nYue" Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-caf5fa127d4so4870266a12.0 for ; Thu, 06 Aug 2026 20:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786074759; x=1786679559; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=7bVqdXkuV00QULLPySg1D37iePHKV2Z9Jhad4OgmOq0=; b=WZU3nYueknho7pKNvdlMK73Fl32WKXfkWlYCRwcpwNKKG6g+A3ic6xkFqEAyiMY3FK cZgTDjFQO7x83pWCRDE0ZLw+/UYUPNlHL0+cJ8WOWWa+rnMm2HOvUb+5iIb4Mv/UBSvK g4dyygEvAZmnciiTDR2cGkKkha6Wzxna76pvBwP7R+zzjkJNPpk7+gHn4BljzDKSCqXm CyHPF+gvogWkKo8WJINdIRYagZzfIgegXBerO6ub6MDA3T9kNQ+APaEFolME+ptD1LL2 M016AUC+6P6lHp9ajAqZIHanHSX4quv1xkOm4GSJ0wHVMHULSz22MaGjFL+ikCI0qXVA QHvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786074759; x=1786679559; h=content-type: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:content-type; bh=7bVqdXkuV00QULLPySg1D37iePHKV2Z9Jhad4OgmOq0=; b=OPCuwcCxWPCzh5DhIeI6RRE7MfKcfiPmQCDHNDrI7pAZIRUR9VKykmvk93tL8tEJfp A40QAukJ2v7jDWdejcFLyLHIQvuYZPIPrmxUOMrRtats3VzxQERJUEuLhjDsetWL94Sn DbZJEaeGEoRWgdXkn0RlcotmzNGpQ1Qek2aEdgLoVdTVr61bzv0JixVYXsusqx2IFZqi y71MDtcoiQQkuejKWghP+UJKrGISHFOQKT3Hvsjt2eSAhap4twDUWJidfXKojxZ3/XqI 2ZMy7ySyw2nGW+ZKXHZOF+OuBlj468RhfqyTt8bGj7J7FPyoreB7Tq+IPL48FpqaTXTv erGg== X-Gm-Message-State: AOJu0YzXTaG9KX5Bfom76cSs8UhLO7UkVzQT+3bGuUxz9143XTC6uHP4 +rPlFy5r1zUTQY0JnMniCBTf02BEXgajQDCPxx26C3q+Pv45vLFAu5bSc0bGfgHsfrs82GxdZeJ VkAOBQulyBsUedIS2RlfzCH7J2ARxq+GW4dnMa+Y4lrdy/6MD82YqU9rkd4gjxFfKQ6Ub6MvomP ct7raGb1Bg3LOAAFdrJ4D/MjiSyDuStU4JjIxcMvVQkUuVNkLR X-Received: from pfblc11.prod.google.com ([2002:a05:6a00:4f4b:b0:84a:1bf6:cb4a]) (user=jstultz job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:847:b0:84e:5e4:b9a2 with SMTP id d2e1a72fcca58-84f5e1136d6mr683972b3a.36.1786074758272; Thu, 06 Aug 2026 20:52:38 -0700 (PDT) Date: Fri, 7 Aug 2026 03:52:10 +0000 In-Reply-To: <20260807035232.1881495-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: <20260807035232.1881495-1-jstultz@google.com> X-Mailer: git-send-email 2.55.0.654.g21b8a5bc05-goog Message-ID: <20260807035232.1881495-5-jstultz@google.com> Subject: [RESEND][PATCH v31 4/9] 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 , Andrea Righi , 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: Andrea Righi Cc: kuyo chang Cc: hupu 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.654.g21b8a5bc05-goog