From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from SN4PR0501CU005.outbound.protection.outlook.com (mail-southcentralusazon11011043.outbound.protection.outlook.com [40.93.194.43]) (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 976C33BFAD4 for ; Fri, 17 Jul 2026 11:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.194.43 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784286997; cv=fail; b=sZYiaeRourMNFCk65DZpP+see9QEeZcmSa54Ud0xSTNC1r+6Woy+iHd9yS2VNo3trEyrmRwXtmHaXUf7vVg7Wle0WPA/sTnpkG1hBQz/+rBDoBHcmjKFCCbHct/dh/x+Oe56oOkBVzQgafu26iP9kw5H2qX+ixSQNM2SKfTsUCY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784286997; c=relaxed/simple; bh=2LoYMPcFZY4iaWX5PL5wClqrmdkaiLhrZWZ/SQ+2Xho=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KhMQ+8E66dCbLfUz9jUZFl+oJOmagHMO3eGYqTDX+WD9b9JU+HV4NDakqhU4KB9hxwO0hXeIVmLcLi1rLJ4ppjP/7ItdV4gVpfv64mvC0U97Vo1HDThX0MpDGPxDmF8KdyF3R2uT48A1oWZZIGrTgEK4bLMXsVrh2TvpmLTwcs4= 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=hTQ9JNlM; arc=fail smtp.client-ip=40.93.194.43 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="hTQ9JNlM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a1nOkbgFW97V/rnzZRiiE+TAPhtdHwrbm1R+V07Yb21kLJbUbpY1VETIgo2PfMClnvSYSJxXsMxP71uJkoQPT1khg63ZFb2X7cINUfh4XCpsoR4+uikVYKUqBp26AW8GZ796Bsu6fZQu+CvZYin26cHUcxOsJrWIwHqhhMiAEPIxhwKhsiVqiB7qQ/SKnDit4wGYKweGFNHiuLt3K13QTSWE5/asHcXrcpZIieqPoxabSkRtZjm4kFFHZmcoNFg5wQrweZYBpUOtnTfi/jUYz/pF3wgAq5WH/gCRmHrC7eODQ8YFbI5wx0y636e9fNqbUq+8NukSyX6gPTRa6Wza6A== 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=IxX5Hug+Ctx9kDiE1gl5PrcTHI+TfoelOUxVLMSSurA=; b=ODN0vOhCTUhMwNN3gY+F7ZvOgcOVJg3afCZiOMgiWwsMh05Ze2cV3FNEG+8XJTGKiL0MGYalHRHQwcU+Ae/sitY5ss1XdWC4zIpT3y8duryQoFR5oREQPm9/3sMggY2wzt/ksN5AJDV0f/Xp9jwP6jmpPgLovaHgj+SMLbwaH3Y00OeYLlCRrncAyMn+7xjkGhJFi2YyBuES/hwWhaUfn5C9WL3/yuRF0TUV5wywZh19QF7lUNf1GOzd15jqIH/pOR2J8ekT7/4/WU2Qz9ZjY0QEVN586wA7Uuq88k0G2WO4gHPEBevogamiYg82Z37wB3LXfEUBziPSg++BYQP4WA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=IxX5Hug+Ctx9kDiE1gl5PrcTHI+TfoelOUxVLMSSurA=; b=hTQ9JNlMapLh2FDAI3CVW5gSJqPU4dwtccSfq/WWKiHGBKCQPeQHFfJKKVMY8H2KlmByP8wM2xse8c41DA3hj0TSo/O20MOT5nlKqKfdR9HO1l46M80PtUyz4gCWvoQINk5A/wwfTphlAGZYQinS44CmPEK8AVQWqmLRRva+56I= Received: from BN9PR03CA0741.namprd03.prod.outlook.com (2603:10b6:408:110::26) by IA1PR12MB6332.namprd12.prod.outlook.com (2603:10b6:208:3e2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.223.12; Fri, 17 Jul 2026 11:16:24 +0000 Received: from BN2PEPF00004FBA.namprd04.prod.outlook.com (2603:10b6:408:110:cafe::66) by BN9PR03CA0741.outlook.office365.com (2603:10b6:408:110::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.223.12 via Frontend Transport; Fri, 17 Jul 2026 11:16:24 +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 BN2PEPF00004FBA.mail.protection.outlook.com (10.167.243.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.5 via Frontend Transport; Fri, 17 Jul 2026 11:16:24 +0000 Received: from BLRKPRNAYAK.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Fri, 17 Jul 2026 06:16:16 -0500 From: K Prateek Nayak To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , John Stultz , CC: Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Joel Fernandes , Qais Yousef , Zimuzo Ezeozue , 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 , Vasily Gorbik , Subject: [RFC PATCH 0/3] sched/core: Allow proxy execution to work with core scheduling Date: Fri, 17 Jul 2026 11:15:58 +0000 Message-ID: <20260717111601.6017-1-kprateek.nayak@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF00004FBA:EE_|IA1PR12MB6332:EE_ X-MS-Office365-Filtering-Correlation-Id: 15fd6053-e4da-4bee-8c6f-08dee3f4d6a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700016|23010399003|1800799024|82310400026|56012099006|10067099003|11063799006|22082099003|18002099003|13003099007; X-Microsoft-Antispam-Message-Info: EUPl0C7zaH79Z8e0IvT0GSJiSHP5DdkF9boXx0wcl9vY3D+TAiG3s5C1Es5HpDXsZdTZ0zWNh/VAngCi6wRjcvHSM10RwFc+6SKkrHivjDIPWkphvYqbabBZkBVgOPnqGaad/9VIzklrXdrLbjJ9npK11hQvm8lsmVpCwJpIVGuWDpbQmLIuXiqYKF9qUWd/tSo9e28mWEItegBkW+EAld901Y741CcgRKur0XKxPdyDyB8lUVmPM8v916HX4nwEH5GWUDHVlJar/rTUqncUQuiLzpTSa459AcmyhByP+wPfKWefPNGXO5P/LQxoRmD1GObc1p5smWx23Q0xwFTwt09HGEBUVW/GlyqgFvRw9lcRD3ErS7meB2ZJN2ttc7nAVNT51hep4hjTy4tDALHpSItF1dGAQSukd/Tuw8OfjFMkUuX+hUOPtZ/AZEhkrDIIJMYyYoaB97lIa/+PkNEgFH0fKzzi1dng5iRu/mpukNV3U7YpIAdGdtBUtFDy6Y54KhKcHQk5FtmGjx2ngqVk1pSxmfBgAD/CJ+MCQdN8pwh0Rd86XiRz2MgqRHmQBKZjqrSBVtS7EqFGeI8f7QsVIOGJ4Kqd18sv/vQKJdKvgxBtt1MHhZvWXRcJBKNKyvuFarsyHxEJDjN48dC9o8ExAg== 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)(376014)(7416014)(36860700016)(23010399003)(1800799024)(82310400026)(56012099006)(10067099003)(11063799006)(22082099003)(18002099003)(13003099007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: boMmj4z3sO6/KXWEtkN2T16TH6smEyD+KtGsispBfYs3nQsO+8FSrVvR66Q9yEThAUHEXcvW3oMVW9aczx7TlDcfX25YOzN+EP8yp/k3+3tx9dL18fsueEmJDFLIOqR4aT2BkQId/2cj0XKN/yM8c9gumd6h75dmBePLy0ixm1MN5Px6z0ZtI4HJC/jH/dF15EJgTRyIFD8PPpeH7Ip3XD+GN0LDHNkdtK91VA77BVyOVZpbFdUHY+a0SlpE7RjR6j7K3r85XXOMmR+7oQA/KeXnYk9ktryI72TdkHNqN36pXRO3TUhZr4SVxyqLMthlNZ+ll+Vhj6iMTDmwE+LvV1TwOqK7+G3yHsPcw6z8Q3OFqpi5E+DA/0CzYgZ+uEK0HcEzMEO9vsOY47cmWMcQXijtk7jlYgVdQMlYC2784N2sQB2YAHNSblBrm0YfSfyp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2026 11:16:24.5881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15fd6053-e4da-4bee-8c6f-08dee3f4d6a9 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: BN2PEPF00004FBA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6332 Proxy execution runs the lock owner in place of blocked donor returned by pick_next_task() but the lock owner can have a different core-cookie compared to the blocked donor and simply running the lock owner under those circumstances breaks the guarantees of core scheduling. Allow proxy execution to exist alognside core scheduling by forcing a re-pick once the blocked_on chain is found to be stable in __schedule() and then swapping the rq->core_pick with the lock owner allowing the execution context to dictate the core-cookie. Lightly tested with John's priority-inversion-demo [1] patched with "coresched new -t pid --" and the plotted chart seems to suggest proxy is working [2]. Your mileage may vary :-) I'll update the thread if I find any nasty bugs over the weekend run. Patches are prepared on top of: https://github.com/johnstultz-work/linux-dev.git proxy-exec-v30-7.2-rc1 at commit abb09adc985b ("HACK: scx: Add scx_prio_inversion test scheduler") with commit 93bd6418a6ea ("sched/core: Skip put_prev_task/set_next_task re-entry for sched_ext donors") reverted on top to make !EXT builds happy. This is essentially a formal version of [3] broken down to be slightly more readable. Comments and feedback are always appreciated! References ========== [1] https://github.com/johnstultz-work/priority-inversion-demo/ [2] https://imgur.com/NsgWqRx [3] https://lore.kernel.org/lkml/9ceb2af0-33c6-40ca-b855-5167a9c5ae0f@amd.com/ -- K Prateek Nayak (3): sched/core: Track the core-wide pick leader sched/core: Fix forceidle when lock owner has mismatchd cookie sched/core: Swap to lock owner for core-wide pick on core-cookie mismatch kernel/sched/core.c | 129 ++++++++++++++++++++++++++++++++++++++----- kernel/sched/sched.h | 4 ++ 2 files changed, 119 insertions(+), 14 deletions(-) -- 2.43.0