From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azon11020084.outbound.protection.outlook.com [52.101.46.84]) (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 74A273CC9E4 for ; Fri, 26 Jun 2026 05:52:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.46.84 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782453140; cv=fail; b=hdntRpg7tcede/HIPIQvVKDypJrnQ0TBKmmwnIf8aZpiI28WYK1vtXr10ZJ+s8C9yDrXm4eKwUzYDGAUNQM5iEWXazsIl+KuUbkbty9VB6hGIyt1qYc5TEgSPLksAMkoc04BiixoQuiia4wnACeO9fUeVxI3QtSD5AW/rUdHU9E= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782453140; c=relaxed/simple; bh=BApKi0i3krF7QgBJmJtmJkrPQFlKmfwKqmyQr20QPzc=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: Content-Type:MIME-Version; b=Fu4cE7IF9Jd/54Zq1lAyQ2WOfEDCxMsdh/nO4Yx2QjtUt7xQuMaetESVtJ1wyya9khuWJa2UGJVdhA5OyXhOoJUvz5v+/dcyDr9sJr1/ml68ny2rVWXlz8tXunqmM5vASM+KA6iKqut/ltOx1MOK1K9bNQUREPET0ggRwCXfgwY= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=os.amperecomputing.com; spf=pass smtp.mailfrom=os.amperecomputing.com; dkim=pass (1024-bit key) header.d=os.amperecomputing.com header.i=@os.amperecomputing.com header.b=hSlt5auT; arc=fail smtp.client-ip=52.101.46.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=os.amperecomputing.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=os.amperecomputing.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=os.amperecomputing.com header.i=@os.amperecomputing.com header.b="hSlt5auT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=D/ycYBCDKmTB+P+1CkZq885f+s0MNYRA5t3sxNQ4oh/2kH5ilLr6AbdSZvmu3OkzgFfgn0YfgfvhhZ0b+NMQgEiStU5j4KHAMDAeCJ5APb+glo73GQS2q9b3FRa0RKBGBWeYIO4Is7pYQlijqRzZm/mPH5TsY66PCbkIIFeVv41FSRDtCOXZin+uwiL4X63ZUuE17XaY2QfZm03d41uVIU2vT9IRljKJnI4hG2hikUZ1Y/Xf/afayB0+UiQWhhlP3Jyug1uM2V09uKMnA5JP8RG6yXQvb4CHMpE5GNsxnLltCA8AmAyKvjbq8HDZdDYUYAhKQeb1TaaH3EeGJyzJlg== 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=iiety6wi7NFwrxqJBLl9YDKuJ53zbmxF6p0PCZRy2Lw=; b=WAHTVkhK/xxYbNqqC8dK++MCKJDW/BEQb7njxyKNOVESUeYb6BD4RhZWLby2FF4280DytuV+1l5/oor3BNHYKz6rL0kg4fUFiw3YmSlYRW98+4p14FTTQd8RVIDaxa7/4WuKfe53RXHMsQpdNyRHuFo9hOxqQiyClHhhjtb66NJIQfDg7LKfafhHmV+C6FnuceTdzxAln/EBBptp+yRAaL2E4a3Hy2xBtdh1uMxCeHs+rlWpq3HAZ//ztjZpNnSN9f1+v9maSqOdrWMkG3amqK5JmzTBly1Hdz42rTNR2o/EhCwmbPVy4fvojIp5zbpT90Sqs96y9KJ61IhacBFs8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iiety6wi7NFwrxqJBLl9YDKuJ53zbmxF6p0PCZRy2Lw=; b=hSlt5auT1HJ7IKvLmufzn4AefM4//PmH12vuNRcxpmBhoyemZBNwaSilIxYFNIFPrHax8R14LMuKDyoVWEbgNSf910p4XgJZ0KU9SS5EokrcSu63xksPfNwsWSFsQqd9dsOEyGjkd2gWPBd4/zzyRmfCgudODH3injiDAahQBG0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from DM6PR01MB4953.prod.exchangelabs.com (2603:10b6:5:8::15) by BN0PR01MB6976.prod.exchangelabs.com (2603:10b6:408:16f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.159.17; Fri, 26 Jun 2026 05:52:13 +0000 Received: from DM6PR01MB4953.prod.exchangelabs.com ([fe80::4d2:1a2f:e4d1:5f7f]) by DM6PR01MB4953.prod.exchangelabs.com ([fe80::4d2:1a2f:e4d1:5f7f%5]) with mapi id 15.21.0159.015; Fri, 26 Jun 2026 05:52:13 +0000 Date: Thu, 25 Jun 2026 22:51:57 -0700 (PDT) From: Shubhang Kaushik X-X-Sender: shkaushik@sut02sys-r112.scc-lab.amperecomputing.com To: Vincent Guittot , K Prateek Nayak cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, qyousef@layalina.io Subject: Re: [PATCH 4/6 v3] sched/eevdf: Cancel slice protection if short slice task is eligible In-Reply-To: Message-ID: <9d7c6e58-0572-b745-774e-94feef4e7c5b@os.amperecomputing.com> References: <20260624151229.1710703-1-vincent.guittot@linaro.org> <20260624151229.1710703-5-vincent.guittot@linaro.org> Content-Type: text/plain; charset=US-ASCII; format=flowed X-ClientProxiedBy: CY5PR04CA0018.namprd04.prod.outlook.com (2603:10b6:930:1e::31) To DM6PR01MB4953.prod.exchangelabs.com (2603:10b6:5:8::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR01MB4953:EE_|BN0PR01MB6976:EE_ X-MS-Office365-Filtering-Correlation-Id: b20d78ec-94c8-409f-ca71-08ded3470e29 X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|376014|7416014|1800799024|366016|55112099003|11063799006|56012099006|4143699003|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: 3RqjDO2gfaiVCRZAB8uDtrHJW0bYeTapxi+Gm1sb573OPidBAFyws1w04MER3i5Y/noGv8My08T0iSUmj33V3wndbCl3m/5PAE8NSWQhXf6Vla4L7b7MNemHMDIDttC21VY77QkKGY7MQ0TVK3clJyUwt7I3qMZpIiRlnZ5hHApQwN6nz5fUuQbGEbaI6O345qbW+XdLxpG6wT7mjO8DreluiG7TjYkeLpYlBaF/aMRLfr1oLTcpEAWTCdIahA3mxFDsdGIy2PyZFnKVKhW5CcnTNPzsR6s45DHjnXLcDAhfeSt4gQ43P2ubdeZ6IZClrjrWpzalIQ/PyRJngntvGXXKgmClCHiL9kqbF3X4UMAes5Z93Td/yum1nutcAjzjNd5MZzR56dea3dAKrSMXlZ8K0SIuzjTrPe2gOmscR28woUGSDkxR9e0uyR6N76hlQW1iySGte3ZLLoKUdaMIcgaYfRKWHrDjgaJ2YTjYEhbQbih6OJP0Xe6hbjRVm2KCCZ0fOyNWjMQ2rkoGfRHbyoCwiZgOGf9jENF5FAtYzOFj6k7VVaitPxtia9xwvInBEgHC0XowoM+N723sdVo02TIjsDFP2q/zTdmrwrRpliigakrCHuKvWLVteyZRWceHIgeevJ9Rxo7b5dwur2lLmv4in3iOvtnXryMTLBLiahQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR01MB4953.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230040)(23010399003)(376014)(7416014)(1800799024)(366016)(55112099003)(11063799006)(56012099006)(4143699003)(18002099003)(22082099003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6VVM7h78wHuWUOO5jhTjflK8isxkUhYFo2dpV2FopjPrW0gFxSUE4RFJvy17?= =?us-ascii?Q?b4zaRkJC2gXfpoP2nFZ/h8x5y9L6tNMJMeL7PaYwstrPGjVIIDA5sDIdZIp3?= =?us-ascii?Q?nyIERU4fjIECjoy7swLmggC8XaPjE/y3VbsFSGYStzraU/7P/6I58DFkW8+4?= =?us-ascii?Q?AFmApmf0t+RJNEX3wXnTRl7FppZdoWDREhxlCQTBIexRpcCiaKdSNVzz9ivT?= =?us-ascii?Q?c2TFpYjgC0+om0mcx6rw96r5rkybfrfxpIoW0KkbujW6zC0e5iAX4v0jx1Mm?= =?us-ascii?Q?+pa4jhOuIiVEIArmtgGmveeFpNqoHVq+gLTSYwdV0h8LjHCX6qq6ZP1rrm54?= =?us-ascii?Q?qpT2yUK+EFETqN4REV+z2Lujn9E4B0NMxn0RG3KOmqomg3dmMD2xLVlIV8/7?= =?us-ascii?Q?JUHSZfRe86iCsaHHLt7lFFaaikiYIm8kpOyjLgCdL5jO7mYJMgo0IxSYXhWb?= =?us-ascii?Q?RJdyk5ZK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= =?us-ascii?Q?pnlBnxIYF3IciMOFGLwVZwe85L8TeECLkxv8AFA/52hGvLkOf9uPO5t12GkY?= =?us-ascii?Q?0FagWp/cqnak2DMyg7v7IYpcqPO5UBGlIiEW9mUWlpQPjwrbSC8JlcfAHA4b?= =?us-ascii?Q?E2AVyiryGzca779Fk2eKqVX5Ne3XxyyYjPgZWljbXnMZzPeM/60z7ecadniz?= =?us-ascii?Q?21G42PI/5BDQz1phYV9W+Vq0MrNIivMGcCCoQyfDEfDyt6r7LMDJEZFsRe/E?= =?us-ascii?Q?SC0Lh27Y2hw0cr66cw2YTh2ZroPRXxk/NyAYT1EiuJ5IGV97pXaNSKcPSW4b?= =?us-ascii?Q?6yIcljU9fcdFX95GU3S6eSji/cBBTxmksUsD3e21UTMgMxvGecu1f+tGu29J?= =?us-ascii?Q?70hzpDLGaShvGaR5e3/6b2vO6dkmuc/xuI/IW8vuBZn5kaXX/yaV?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b20d78ec-94c8-409f-ca71-08ded3470e29 X-MS-Exchange-CrossTenant-AuthSource: DM6PR01MB4953.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2026 05:52:13.0141 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M7VQtbTKzGlFPedfNKeyoG7sE4PDYVUBhyVQITvhQVmaFyanHbWsyoXWB/+Yh5+ODprevtjmhhlwQaUql6ojyocoTb768yQg2DN2WdWz9E9KWXS1fMynthQuAbUigPsj X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR01MB6976 Hi Vincent, On Thu, 25 Jun 2026, Vincent Guittot wrote: > On Thu, 25 Jun 2026 at 08:00, K Prateek Nayak wrote: >> >> Hello Vincent, >> >> On 6/24/2026 8:42 PM, Vincent Guittot wrote: >>> @@ -9896,16 +9891,23 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f >>> if (!nse && cfs_rq->nr_queued) >>> goto pick; >>> >>> + /* >>> + * If @p is eligible but not the next task to run then cancel protection >>> + * to prevent large scheduling latency >>> + */ >>> + if (preempt_action == PREEMPT_WAKEUP_SHORT && entity_eligible(cfs_rq, pse)) >>> + goto preempt; >> >> We handle "pse->slice < se->slice" case before "pse->sched_delayed" case >> and jump to "pick", but pse can get dequeued as a part of >> pick_next_entity() if it was delayed and picked. > > yes > >> >> I think we can reach here for PREEMPT_WAKEUP_SHORT after pse is >> completely dequeued from cfs_rq. If p is a task on root cfs_rq, we could >> have blocked the task entirely and ideally it shouldn't be referenced >> here. > > I tried to find which use case calls wakeup_preempt_fair() for a > sched_delayed task but can't find it > >> >> Since a wakeup of delayed entity / on delayed hierarchy will call >> wakeup_preempt() anyways, I think we should return early if we should >> directly jump to update if we see "pse->sched_delayed". > > Fair enough. But we still need to consider the FORK case > I tested the v3 series on Ampere Altra using cyclictest with high concurrency rt-app and hackbench load matrices. I tried to follow your same setup for the testsuite as described in the cover letter with the baseline as tip/sched/core. The maximum latency changed as follows:- - cyclictest: 112us -> 62us - cyclictest + rt-app: 108us -> 166us - cyclictest + hackbench: 173us -> 154us The patchset improved the two cases above but regresses the rt-app tail. Would the regression be caused by the interaction between the larger competing slices and repeated short task wakeups? These repeatedly tend to cancel or recompute the running entity's protection. >> >>> + >>> if (sched_feat(RUN_TO_PARITY)) >>> update_protect_slice(cfs_rq, se); >>> >>> return; >>> >>> preempt: >>> - if (preempt_action == PREEMPT_WAKEUP_SHORT) { >>> - cancel_protect_slice(se); >>> + cancel_protect_slice(se); >>> + >>> + if (preempt_action == PREEMPT_WAKEUP_SHORT && nse == pse) >>> set_next_buddy(&p->se); >>> - } >>> >>> resched_curr_lazy(rq); >>> } >> >> -- >> Thanks and Regards, >> Prateek >> > Regards, Shubhang Kaushik