From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 333D3381C7 for ; Sat, 28 Sep 2024 06:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.10 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727504941; cv=fail; b=qiXiG3gzXQ2nMv3IK7zWA1oPIbbPGToMrZA85AsjHbGAVFZPsVapJPKlIwlQBp4ckWQ5S/sSlcNt4me6wbr4uPtCEKnPppyhb+ssKWAWZX0enubua3gOvZU4miFFQmV3T7p0rJXdMwCIvXyttZDqPepRIk55oegHN1jt7Ualwao= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727504941; c=relaxed/simple; bh=zyDhpCn+s2Wy67lJv77Fn24MjVPqS8BH91MawiJXcKI=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=mpODY73238vQTRo7+dvK2GWdjPEknqxL9gbvvwtFEV1R3/7bLBnHnsXWW2JZ90jypuLIzycE5HsUZlSzG3W9B5TiqXrqtzvuV8zeMsqmkwIaqylaUrmTaH9xSRWpMHQTy7hgKeiYApVwwzkHDbhACS2SD9AGKLZMxJrEWVgSHw4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=e4OvN5HJ; arc=fail smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="e4OvN5HJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727504940; x=1759040940; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=zyDhpCn+s2Wy67lJv77Fn24MjVPqS8BH91MawiJXcKI=; b=e4OvN5HJeE2X5VsrmmM4t/P00B8crRHU2U90Hebf2bhQoOHn8NHLAeqb xLxbNxTB98rd2D9GmA0ZfbsimN5gF9mSUmw5Q2vx4KrkEWyvktRXaXrD3 bbyeJ64USam9xXRzzgTLrJYsNf/XTlOB/tNoqsYuq/pGtepmG+9zneSnI Rou84qpKURk8WWpgJLr6JcuqcNI/anpUlDQwdbwU4jF0031h3bbQDqtfE PI8xM8xodNqWj4aOVmc90wDzghnonHUZN4XtQN4aBwCtmeGGsz1sl6FP4 ko7aRltbdCGgXW422zUn2LElK43csC25tnAO4gKqbyI6Vr6l5+fRxV2B4 g==; X-CSE-ConnectionGUID: jURWcUycQyqjLQ5WDxnTJw== X-CSE-MsgGUID: 3+Ddt9HZTbKjY1Eznzg2vw== X-IronPort-AV: E=McAfee;i="6700,10204,11208"; a="44121078" X-IronPort-AV: E=Sophos;i="6.11,160,1725346800"; d="scan'208";a="44121078" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2024 23:28:59 -0700 X-CSE-ConnectionGUID: 1KcQtzoqTlaQyrrjmYxfww== X-CSE-MsgGUID: 4wOL1ZbNQzOeUnnsoDrFKA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,160,1725346800"; d="scan'208";a="103561849" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 27 Sep 2024 23:28:58 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 27 Sep 2024 23:28:57 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Fri, 27 Sep 2024 23:28:57 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 27 Sep 2024 23:28:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PSHjJGR/itKY228kY10omDG+vbxS1f6cWPh4mBwDLQSo7KNNWpvwdjoBmJ9qNegYRGMqBP0C9PvdLGsT7koHltqnVYKcHhSeQliV+YqUvR4Ym2uHWI1b7SwMN4LspqEb3W3X4DbS2YbAP0MRwcvcvJtO2IwXn0ekEZeJCKyCodDtq66oMXbsnBil4WWyhjHdi4d0sG7jTo3AmlPpG/fNPWB4gYbfxOTfGpA1irRPfwQxQKwJsieSeSnswlkutdd2dhOtpxQXNPMX4y8pOtjnW7o8h4mTbB5WE7SL1ptTMiB15gDNSxkXS46033jC1Zszbpebf7JC6slNeLZkT9HAvg== 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=vxyfLhhBA6BUwsar894ydPissxdOhTU2c9gy1C8LWOg=; b=u1EABo+GOzF5TmokYrm18RncGyriFR0NHBTvou6CjvtS2gwY8LcBbKOYtMzJaiXkSLXYBlIWg61TCS4yBLjwd1+jdP+y9fMfnjqjHVo2IN0V3Wfzjyixs62I/yOlSnTqZtQcR4v7rYMu5ecqgxkPn9oVn6w/RA6L9BaPFq7svB8EK+7KT/5/VyxUXZydkjpdc0zzLGUGTbnzF1gN29b3hg23eR3kczhVA7FSO/H3VdIij01wnIzk9OXldMRK+Ynlm4H++YU9jbmT2YwaRh4123jbpvv9KEmAtfljaSq4Y/0R0TtTA5GvgVGJUUu05fw0qCv0bHWVtGRZY7xhCNYong== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6020.namprd11.prod.outlook.com (2603:10b6:8:61::19) by PH7PR11MB7147.namprd11.prod.outlook.com (2603:10b6:510:1ee::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22; Sat, 28 Sep 2024 06:28:55 +0000 Received: from DM4PR11MB6020.namprd11.prod.outlook.com ([fe80::4af6:d44e:b6b0:fdce]) by DM4PR11MB6020.namprd11.prod.outlook.com ([fe80::4af6:d44e:b6b0:fdce%4]) with mapi id 15.20.7982.022; Sat, 28 Sep 2024 06:28:53 +0000 Date: Sat, 28 Sep 2024 14:28:30 +0800 From: Chen Yu To: Honglei Wang , Oliver Sang CC: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Chunxin Zang , , Chen Yu , kernel test robot , "K Prateek Nayak" Subject: Re: [PATCH v2] sched/eevdf: Fix wakeup-preempt by checking cfs_rq->nr_running Message-ID: References: <20240925085440.358138-1-yu.c.chen@intel.com> Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: MA0PR01CA0092.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:ae::16) To DM4PR11MB6020.namprd11.prod.outlook.com (2603:10b6:8:61::19) 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: DM4PR11MB6020:EE_|PH7PR11MB7147:EE_ X-MS-Office365-Filtering-Correlation-Id: b48cfd1d-eaee-4366-f6eb-08dcdf86d294 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?RFd6R2RtRmc5WDJXYWpHNjJ5K1NxVVRxelRCaUNNR3RMTS9Cam1lWVZjYU9V?= =?utf-8?B?YnRqOHFxQkhuNThQVlFlcDRWT2lvQmNUMGd0dnhJT24vTFBxMUZRQWY1WTMv?= =?utf-8?B?b3BlZEFtd1RjYWVTYkdWNjk0OGlUOFlCaWprcHZGbTIrZ0Q2Y3dCZFZXd0NS?= =?utf-8?B?V082empTSGRCVnZuVEVnc1VWSFVBWFg0NzNsYWhEZlB6WlZIZ0hKSnpIcll5?= =?utf-8?B?MmVCL2M5VzRyQ0xMUFhMZjFqTUEyUkhXVS9rbEpMMEdsWUdobndnbXcvbjdB?= =?utf-8?B?Sm8xN1I5YW84SXMxWmRqWS9VY2FhMmlOcnhub2pQMWpnK1c3OWpSWGNPbC8y?= =?utf-8?B?ekNtSm9IbWFmcU8xd1hiRjhXMUs0NXhhUlFqOTg4VmQzY1lISzdlZEFQaGVr?= =?utf-8?B?VytIcmQrU1pmSWM2M0tCcGR5S1ZKZWMyanFJL2dFZkJ5ajVMYk1BSHZMSkZ3?= =?utf-8?B?OUt0OTRNTytldGZpZElKMFJOaTNtQkc2WjM1R2R3ZnIvR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dGt2Qjg0OWx6OVBMLzF6cmJiWjNn?= =?utf-8?B?eXBLcEZhZFZSd1hnRHJYR0NMb2FJLzdJM2FpZTh1R05pWDFzMEZSOVRtK2lM?= =?utf-8?B?SVFCZU9xSXcxQU5XT1JKeVZxaWJXNnp2d2dqZGtTQ1FzZUhWSFNRUG9qSkpJ?= =?utf-8?B?NTByU2JuTDErdStLajZWbmdqSUtyNXdYZy93alZBY25GbENBOWxtZitFK0Mr?= =?utf-8?B?UjF0aXBOdUVLK2NscWFwd2FnSmhRR3RDaWlzSmpyVVlFMkd0eEU3TlEwaFZM?= =?utf-8?B?Q1RDeHVaRHBHYmxqdzZ0bE9sTXJ1UE9LaTRCbDhsVzkvdXdiQ3NRQVhtbVE0?= =?utf-8?B?OGtwdHNyMFk2L1lFT2FINXU4KytCRW9qWDJnNEc5VklEQXVpTW55SytLem1G?= =?utf-8?Q?n/YQTrSSi9FwAACagfXr+oUeh0vZuaZhL6sGI=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB6020.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?czU2Yi9HRG0xLy8vb1cxTldRL1R4UFNKQ2pwTE5CS2cyUElPVStibnhBUWhk?= =?utf-8?B?SEYzbHBvQjB3RGRkbHVlYkpoRUhPN2ZETU5hMy9iM3Y5cjc0N0VHODhRU1VG?= =?utf-8?B?K254QW9vSDdxRVVXbG9VbkdwSE94NTc2ZTlLalc1dHZJdnExVVd6S0NjVFBI?= =?utf-8?B?NStpZEJDWndBRWpIR3dwNklxY3JURzBYMTI4cG9kR05kR000VC9NYUMzUUk3?= =?utf-8?B?QU1XYWZZcEZxa0hLRnUrL2lOelp5REd0c1FLd21WQ1lU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CTmJXSTFuaTl6Rml1UWgrbXBBTzZVenYxWUR6?= =?utf-8?Q?MmkeehMXlt1NfUp5PoAMt41Dw?= X-MS-Exchange-CrossTenant-Network-Message-Id: b48cfd1d-eaee-4366-f6eb-08dcdf86d294 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6020.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2024 06:28:53.3125 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TYrRoy/7fFEamQVcSi+d2kadyEtP23+6yRNxjAoJXRT7ympy6xoutGEAuMKmpgWFXWvWMVI1huzF0Mf+62r91Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB7147 X-OriginatorOrg: intel.com Hi Honglei, On 2024-09-27 at 21:38:53 +0800, Honglei Wang wrote: > > > On 2024/9/27 14:56, Chen Yu wrote: > > Hello Honglei, > > > > On 2024-09-27 at 09:54:28 +0800, Honglei Wang wrote: > > > > > > > > > On 2024/9/25 16:54, Chen Yu wrote: > > > > Commit 85e511df3cec ("sched/eevdf: Allow shorter slices to wakeup-preempt") > > > > introduced a mechanism that a wakee with shorter slice could preempt > > > > the current running task. It also lower the bar for the current task > > > > to be preempted, by checking the rq->nr_running instead of cfs_rq->nr_running > > > > when the current task has ran out of time slice. But there is a scenario > > > > that is problematic. Say, if there is 1 cfs task and 1 rt task, before > > > > 85e511df3cec, update_deadline() will not trigger a reschedule, and after > > > > 85e511df3cec, since rq->nr_running is 2 and resched is true, a resched_curr() > > > > would happen. > > > > > > > > Some workloads (like the hackbench reported by lkp) do not like > > > > over-scheduling. We can see that the preemption rate has been > > > > increased by 2.2%: > > > > > > > > 1.654e+08 +2.2% 1.69e+08 hackbench.time.involuntary_context_switches > > > > > > > > Restore its previous check criterion. > > > > > > > > Fixes: 85e511df3cec ("sched/eevdf: Allow shorter slices to wakeup-preempt") > > > > Reported-by: kernel test robot > > > > Closes: https://lore.kernel.org/oe-lkp/202409231416.9403c2e9-oliver.sang@intel.com > > > > Suggested-by: K Prateek Nayak > > > > Tested-by: K Prateek Nayak > > > > Signed-off-by: Chen Yu > > > > --- > > > > v1->v2: > > > > Check cfs_rq->nr_running instead of rq->nr_running(K Prateek Nayak) > > > > --- > > > > kernel/sched/fair.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > > > index 225b31aaee55..53a351b18740 100644 > > > > --- a/kernel/sched/fair.c > > > > +++ b/kernel/sched/fair.c > > > > @@ -1247,7 +1247,7 @@ static void update_curr(struct cfs_rq *cfs_rq) > > > > account_cfs_rq_runtime(cfs_rq, delta_exec); > > > > - if (rq->nr_running == 1) > > > > + if (cfs_rq->nr_running == 1) > > > > return; > > > Hi Yu, > > > > > > I'm wondering if commit 85e511df3cec wants to give more chances to do > > > resched just in case there are 'short slices' tasks ready in the other cfs > > > hierarchy. > > > Does something like rq->cfs->nr_running == 1 make more sense? But > > > maybe it helps less than 'cfs_rq->nr_running == 1' in this hackbench case. > > > > > > > Thanks for taking a look. > > > > It could be possible that Peter wanted the short tasks to preempt other quickly. > > If I understand correctly, when we say preemption, we usually consider two > > tasks which are in the same cfs_rq(level). For example, check_preempt_wakeup_fair() > > iterates the hierarchy from down-up until the current task and the wakee are in the > > same level via find_matching_se(&se, &pse), then check if the wakee can preempt the > > current. This should be consistent with the tick preemption in update_curr(). And > > whether the short task should preempt the current is checked by > > update_curr() -> did_preempt_short(), rather than checking the cfs_rq->nr_running/nr_h_running > > I suppose. > > > Hi Yu, > > Yep, I understand the preemption should happen in the same cfs level. Just > not sure the purpose of the 'nr_running check' stuff. Perhaps its role is > just to judge whether it’s necessary to do the preemption check. If there is > at least one more ready (cfs) task in the rq and current is not eligible, we > take care of the waiting tasks. Thoughts? I got your point and it makes sense. Whether the preemption check should be triggered seems to be a heuristic trade-off to me. I'm ok with using more aggressive preemption strategy as it depends on whether that workload prefers latency or throughput, and as long as it did not introduce regression :-) Oliver, may I know if you happen to have time for a test if the following change suggested by Honglei would make the regression go away? Thanks. thanks, Chenyu diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fd2f3831c74e..290e5fdfc267 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1247,7 +1247,7 @@ static void update_curr(struct cfs_rq *cfs_rq) account_cfs_rq_runtime(cfs_rq, delta_exec); - if (rq->nr_running == 1) + if (rq->cfs.nr_running == 1) return; if (resched || did_preempt_short(cfs_rq, curr)) { -- 2.25.1