From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azon11010046.outbound.protection.outlook.com [52.101.56.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21AB7372EE9 for ; Sun, 15 Mar 2026 17:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.56.46 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773594136; cv=fail; b=Bku0f4VUrfEUVilnQ61SkdFHvtZhUmlu3nU7QkaEweNyU0nK1DMvN91KYsCQQZYbuMPfi4Pg2HJX0vspJR9WXsnYU1tK1aAWUAS81u+yWWrX+J11KGkKO6tyN+ANhH9e2YRTsZY1IiNpFnhbb+fxCeZaIKwyC1MHMBO2hlvS3RU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773594136; c=relaxed/simple; bh=9pO6JcbZUgH275LarudBOtr+KyMJsaYCl3E6bciAhRo=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=Mxrh0VQ6/VGP1vcMCPhug+ot3EvlmNfqY6pjWfV8rA+bgl1idvqCyskHNcA4JWJs+eVcjY7EKHhvJiJJZdwLp0KPNCc1FD08YhHvkOnsOY3OU+0x+RanrYdmZe0wMnFnXRmQb+tZWMqLiqXNr9KQZX4qslCRhubrEUXdpZmHcic= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=KaYt5ej0; arc=fail smtp.client-ip=52.101.56.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="KaYt5ej0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q0ygSjOmPNaSSNflspQT5eKuG2Jl+wMmsd6AVeboJx+vGN7BDl8RNLVs7PhM5EI71arW6aGZYTmCGeUf48G2LSsZB2aTJj8HwPJ5CsNEFKFGpOZ8PSSZItEE6h+bVKqIRQUAyfKS2Qx/LA9eJNMo64L/TVc/FHZdiUZv8GjYvPueBqACgobmsifuqyHrpXBLowLBC/6uVFoQu859wqWql6RSY5tZ23aS0BoenJZtY4kVW/GvFX5fsXuW0VKnJxrZw+I6XCcabwy6TfTv0tI79MtUerknHjg+TR3zUWCTBrW/ECn/n6ETY1qjAS5CVyxT817M+68oKy2xVnPhrzoSPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PxDY5ww5sFS88jaZ+K25+uOyLMTQi87kKhQgEhIR51I=; b=IncjingNT/+UaRwSvDA4lAr+dDbLEgemYf9C5fqaLCsJkmSB2TMES//t568NiLAVrWT7Mn1RVcTgc8Sp/RJZBgMV1TOCfUeHebgaLdc+jTd4LptiFFj9GtNlnrjgoz82maeeAbSWYPGIfhvH2H0VQfYz5uhv81o52hIO6mUh+NHEPMobdx6HbzYRh1ygMul0mioBOzsB9Vkr//VysPHd286S+PZp5QI201DwXuYCIA0Q/pGraXrlOiqt5prL9h1NvmwdJTdbLRNforNdClhamZZu3i7OnHxcYCxQsw1bjnBAI9dnrwCILVeyFDu92nnOSmwVc80IR2aY74ifi5gz7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PxDY5ww5sFS88jaZ+K25+uOyLMTQi87kKhQgEhIR51I=; b=KaYt5ej0lbci4ODgKmrPKnz6EmrGkHWEPca05+MPCFiD8OH/1fCYVWpDQ2hm9WvgHizJXJUaP5qzuIwrgJzxRpDq4KLhJQAUspYv1jiyPQipc5DqdI82w9+X0OVYml0JNw9ixDRS9uDjIjpT5ewtzbxGi9Xd7qeB5qjMrKlvSJo= Received: from SN1PR12CA0054.namprd12.prod.outlook.com (2603:10b6:802:20::25) by SA1PR12MB8966.namprd12.prod.outlook.com (2603:10b6:806:385::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9723.13; Sun, 15 Mar 2026 17:02:10 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:802:20:cafe::34) by SN1PR12CA0054.outlook.office365.com (2603:10b6:802:20::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9700.22 via Frontend Transport; Sun, 15 Mar 2026 17:02:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9700.17 via Frontend Transport; Sun, 15 Mar 2026 17:02:10 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Sun, 15 Mar 2026 12:01:46 -0500 Received: from satlexmb08.amd.com (10.181.42.217) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 15 Mar 2026 12:01:46 -0500 Received: from [172.31.184.125] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Sun, 15 Mar 2026 12:01:38 -0500 Message-ID: <91ae0ae8-0ba6-4edb-9d85-e54e19bd6d6c@amd.com> Date: Sun, 15 Mar 2026 22:31:37 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v25 2/9] sched: Minimise repeated sched_proxy_exec() checking To: John Stultz , LKML CC: Peter Zijlstra , Joel Fernandes , Qais Yousef , Ingo Molnar , 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 , Thomas Gleixner , Daniel Lezcano , "Suleiman Souhlal" , kuyo chang , hupu , References: <20260313023022.2902479-1-jstultz@google.com> <20260313023022.2902479-3-jstultz@google.com> Content-Language: en-US From: K Prateek Nayak In-Reply-To: <20260313023022.2902479-3-jstultz@google.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Received-SPF: None (SATLEXMB04.amd.com: kprateek.nayak@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636B:EE_|SA1PR12MB8966:EE_ X-MS-Office365-Filtering-Correlation-Id: fe5993b3-45f1-469e-d961-08de82b498e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700016|376014|7416014|56012099003|7053199007|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: 6Y2dE3QS4JZIp8+mGcGR9L9QMsAMXbXSHhlJK2AKzFds05bLhwBhQM7sy2T548dkAFWRuK2dU+BJDB4EhNH5iPowxFWaZPcoSHnyP9Q6//RjF/3uoZ7uAxjyml/7Gg0k/WNYQ/1Pj3UlzHUGI5xq0mJU1mDKn8cmi6EJYYlYr3+UconkcgHyBPTS3oiO3fSrLCQWJgRH0PFRuvbrE6f/YepgNmJQ6s42W5uZq+5N5j2U3bTBtdfOkh6kxLazRxbGLMSZqVyjDJe4ix3XMLj7wjmk5nEb1k1OcOWYi6Rzzcf0kR7lWkQ0jSNOmvSN7/4orHxKtkiAiDM//vx74JTLALGCfjHXyEzLlTbAjkkaVIxXPTmeFeOXJE1Nprx7C0AuHvvAilrC3psYGBsbXYaykLrQIQ2iFrC7xwW/xudW3dDUYavE6gzNJMn/NQp9h+OHJuuTcXUI6eexDtqfkGKy1fuIvRDmxqHRUCDSY3kLmL/qcWW2EOx7GcPUSgTw8wJAqMp30w7rxwbkSK3oe5Q6jocXxz/LpCieL7v9Hmr5ZMNC5Fp3/yx7Fw9RmAc2cvyRxV3R/jnkyvmjuq35D2aeDYuHaAI62NAmJcEyt7FfwUundcDIBo3Hvzgd0eW+x9ftGrLyFOTqbCODBGvIbtXrAwYZ0o/pqPDJTfSWaONSE3qRZtDUF0LgCl3eFVQRXXoxHrwicfwr5hjqPCq9DJUHbLgyx3DL8AfVxjxQZi+IrZQnzb1D7iaRJmkGgNrZko5W0l3qZ7jdNyGYMuxWVf9Mrw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(36860700016)(376014)(7416014)(56012099003)(7053199007)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PpDmxCXApFzsAUgYZ1r9jnyvopX7TYayxpOv/qBpF7uMGo5M0Nwd8t1PSTiUROPt1/HYROOSBBcu7mRgxOVBqNQbhfKACj85K4WOzXnthmB167954GUac6qvhYhTekVIA2ATRblQ1Dm1sB/68jwSg9+Ro1sDe8+orjeOyk0AcfqouX0bSlUn/2jMtYGEWbgpPwBd1PDZt0LmAzfxwYIOc3+lcBTULooUIQVlLMf4VRkyArTaQ7/oyl+AFeywdXI2XOxsw0FexFwTFlvD2Kbm7dGnDD5nmNN/D4wzqbO5dZfV/rIC0Sl1mOZYlZL2ewO9rr7/JolCDU3vrk8ytT3d8b6cUyQX317Bpk1luCsx5RTk458wzaqUP59W1J5Bp1gO+TH06rJuKB0ag/+cyfPIK1xGDwbxZ2RqKIlP3kdlIhX2/NOy0nYivPzcbfgF1S+n X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2026 17:02:10.3600 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe5993b3-45f1-469e-d961-08de82b498e8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8966 Hello John, On 3/13/2026 8:00 AM, John Stultz wrote: > Peter noted: Compilers are really bad (as in they utterly refuse) > optimizing (even when marked with __pure) the static branch > things, and will happily emit multiple identical in a row. > > So pull out the one obvious sched_proxy_exec() branch in > __schedule() and remove some of the 'implicit' ones in that > path. > > Suggested-by: Peter Zijlstra > Signed-off-by: John Stultz Feel free to include: Reviewed-by: K Prateek Nayak > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index d86d648a75a4b..84c61496fa263 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -6597,11 +6597,7 @@ find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf) > struct mutex *mutex; > > /* Follow blocked_on chain. */ > - for (p = donor; task_is_blocked(p); p = owner) { > - mutex = p->blocked_on; > - /* Something changed in the chain, so pick again */ > - if (!mutex) > - return NULL; Previously we used to return NULL here when "p->blocked_on" turned NULL between the check in the loop condition and the read here but from my analysis on v24, with PROXY_WAKING, "p->blocked_on" can never transition to NULL with rq_lock() held for a queued task (it can only transition from a valid mutex to PROXY_WAKING outside the rq_lock, both of which are not NULL) so we should never hit this condition now with the new state and this should be safe :-) > + for (p = donor; (mutex = p->blocked_on); p = owner) { > /* > * By taking mutex->wait_lock we hold off concurrent mutex_unlock() > * and ensure @owner sticks around. -- Thanks and Regards, Prateek