From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.189.115 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796234540; b=Rk4lAMR8O0QOGs0deWh9pvXoiCJgRjSWAjurwcCLWjTtqFW7CUBQNLbmqPo+SY9kUnkw dJokjeydEOai3tRy4mwd9wcO25Zk0WGA0xQbmDvHsAL9onLiszSnuTaZ9S6URFiYsZz6W lpjedJH48FSy//2JwiInvA+aT58Hr/ylD5oobE5rvcEf2NS95N/bb+vxumGd+Oh7l4AWJ ZLxIMf68TzMsXgQvVtDuSRIuN+ZXHC6yYx+u6q+OH7RsHonrqXBZ5m+pw9lQYfk8W7g5L UFuw06MxXl40kO7ka+r2LLYtbVqDrhFV2Kzs9uWOq8v1ZIw4TzIed0UE90uIuHgTRdw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796234540; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:To:Cc:References:From:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=R0K8IgYcQ4j7nurYQUjRTl76ww/xe0CejQiBJdyd2P8=; b=0HsVNBme6plaSyKYNmBMXWzU+HJ7YEtnaGVqv7/2dXbO1Xw+8+L5x4EkAz6oSf/7wdxE 0GMykCA/MCZmS0EVNO95y+yNRk2qAbrmtzwv1U8iK8AAEUBRVsVNBdZmqKrVQsO3ZqU1r T+sq3aC7pgpfArwCFEHSUcTLcoKg8OoCPxsFtFJF1HmNoh9hIOLjY36i3JMF7odTB4JMd H9JIUk63gwYBwSzVifLFYOBUVPWP+Pk8eosgRuKnFRxllCUEUeiEjDtBgFs4/USYggucq sSk1ioNj2kP7K8HnTqymPFOZquvRahGxhg+dUOu86P/QigbXf1iGeQw/lx1IvhdcX0A== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=M2EqLcqI; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.189.115 Received: from YT3PR01CU008.outbound.protection.outlook.com (mail-canadacentralazon11020115.outbound.protection.outlook.com [52.101.189.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49811606A322; Wed, 2 Dec 2026 18:02:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 49811606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=M2EqLcqI ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ihh/g6Vj4wilpbWMI4xHRUqyU1CgVqtqcmchtc99BjW8EJ/tEdsMECPRZjSwH9rMFJb9I7dhFXNuLvggBXJQ5ZFHIPDCOxJ0srG22+nzosQGmcfe+sdb1rQQxh5Nob/fJnQhFK4uC6DpudGKDRccUFq0H55bz0ptxKFcAuUEw+2dyZpc2Qg+XT98ncaK1asfqpRpZrGSeKu+kR5H7MEBGIIjheekISO7ciHNb/bZRzrtTtf1sjn9gKtRQhf/dnxOoS+B3R3PyGf7+pVwKq9pgMINCTiEmqyE5C3GxOhGxPmYkK4iA7gFbTj/AOi4jV8Vz2eTaYYRnS6np4N9OkjrcA== 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=R0K8IgYcQ4j7nurYQUjRTl76ww/xe0CejQiBJdyd2P8=; b=fWML1tCY+jt/VOAcwrmKtQp8kdWQFbfyC6IgirStOrabMfr6yP5EWEjKMIZYWRvjQZAJhS38tw77VpR84BpAeXHr47pg2fqonJl+vHws88+hNz9wTfFVY1+5rfmNiigwGP89p8wxk75dxIcHW0CaHbFcA5VmktLezalfxeoqwn+6Qykv/8F+CTbf4N1jQR26uONXaeQiRyP83cZU+DKxaZUVSZ/06G9F8OtvQIoodEFkAQoDZ5AuyEnqJr5xhS8MrZUVoSqmcM1macFPLDOZq+8aaXAl4Nx8LgLjo4x7+ib6HXBAejwnZl1H7xMBDAdYeeAxpUt3fHIwfr/ZdzjuRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=efficios.com; dmarc=pass action=none header.from=efficios.com; dkim=pass header.d=efficios.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R0K8IgYcQ4j7nurYQUjRTl76ww/xe0CejQiBJdyd2P8=; b=M2EqLcqIERzaQTzs7xiBWxBxUZT+sxRBuwkCXf/qIXwwJrEpqqwroQf1AoWldt9DWR5K2X5zlB9CLC0oTQ/Peqy+B+aXlS3QaiL1W9Myt6a9WUUg1LNf7aoYGe2HX1GBMkSUBfzIPL0aLy4e+u5Z/R2gmkTJ0qcCYkXeyYmcurlREY4LSffxWzWcLNbRooBtduH4d//Sa14s1yBwGlZHXYJwTBilQPK2TJQSagm75d7wrSIIRidJW1aO4F8e8MqHkjh0axYv7VTfkW1l3Q4YXdRcZE5jHVBfzSYooGRpMIdHwiqfBmJ9BjiAQFrkfGG3FUxCEJ6NXaTxKwx7c+Xv1Q== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=efficios.com; Received: from YT6PR01MB491026.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1d0::10) by YT5PR01MB10882.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:136::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.11; Wed, 2 Dec 2026 18:02:15 +0000 Received: from YT6PR01MB491026.CANPRD01.PROD.OUTLOOK.COM ([fe80::6b9e:a901:67c5:7ddc]) by YT6PR01MB491026.CANPRD01.PROD.OUTLOOK.COM ([fe80::6b9e:a901:67c5:7ddc%6]) with mapi id 15.21.0688.010; Wed, 2 Dec 2026 18:02:14 +0000 Message-ID: <9430f4cd-bdb6-4003-98a2-740296aed499@efficios.com> Date: Wed, 2 Dec 2026 13:02:13 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v13 05/36] sched/deadline: Keep a departing constrained task until its next period To: Juri Lelli Cc: peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, tglx@kernel.org, will@kernel.org, boqun@kernel.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com, luca.abeni@santannapisa.it, tommaso.cucinotta@gmail.com, mathieu.poirier@linaro.org, longman@redhat.com, ridong.chen@linux.dev, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, shuah@kernel.org, bigeasy@linutronix.de, clrkwllms@kernel.org, parri.andrea@gmail.com, m.szyprowski@samsung.com, kayracizmeci@gmail.com, weihengqiuu@gmail.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rt-devel@lists.linux.dev, oleg@redhat.com, brauner@kernel.org, stable@vger.kernel.org References: <835511935d961be832cbaf24e902762d1926e611.1796146461.git.mathieu.desnoyers@efficios.com> From: Mathieu Desnoyers Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: YT4PR01CA0290.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10e::23) To YT6PR01MB491026.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:1d0::10) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: YT6PR01MB491026:EE_|YT5PR01MB10882:EE_ X-MS-Office365-Filtering-Correlation-Id: f7184bbd-8828-4c6b-3e52-08df509e6510 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|23010399003|1800799024|376014|7416014|22082099003|18002099003|56012099006|10067099003|261028144727099003|261022105027099003|261022113327099003|261026121527099003|261026140227099003|261009223027099003|9063799003|4143699003|3023799007; X-Microsoft-Antispam-Message-Info: cogoA+k/KgQDhbJPWxqubXR53hzksf0ron3s4StaLE0xrZ7vfMAXVllCIr7pyQmTsK4o0GcXoos1OCQ0NQNleXkQotL1eoDdUEbqW8KjtH2GI/jVN/BK8L9jO3kJXamLwas5clTHUiDSPDMMfc38U2XRrU6EU0GfbGqcbac2/Mi3tM+It7ykpq93iq7/SkEdD0cJhL5tcRhrJYZj6okywhLAmuY/tlwb8ol0qFWkRFjhH1ffmf49HnD+rvA4juxwCwXNaejh4gTg6VweGMglgpTg/uMZVe/nHMIlnbUbRQcmTkZ6NGDsgWSHKcDQj2F6iV5Kx+cYuFF8mUE/Pb5ZSoG//piwFuc+LTkb9UWKXqVCG37mXw+47NO+KaKbdGIxYcZMpuPEGj47uQYx3RfhWEWo0dE+YjiNmB/ZX5GJoKtMIjD0zf8SuR/gxLS2f9/JtoTbup2mnMZz9d8CKchse2YEsjqia7DiESCqRMH3cLw0Gi39xeliYqPwdSJg2F+aZ9RnZ1HgieM02+WVu65tCAUkYcrHr95BEro1lFeOPfdymIy42icKjRGLUvy9FnCb4pjvg81PfRlIo2IoUpQYMK2tBmcn1IydD/AQyfTReH8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:YT6PR01MB491026.CANPRD01.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(1800799024)(376014)(7416014)(22082099003)(18002099003)(56012099006)(10067099003)(261028144727099003)(261022105027099003)(261022113327099003)(261026121527099003)(261026140227099003)(261009223027099003)(9063799003)(4143699003)(3023799007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eElmcllqZ0NMYVRqQ1dBcXkzc1oyeHJDYXMrM2ppYW9SVHlwM0lDQko3TGJT?= =?utf-8?B?VTNVRlFwQzhYOHI0UTlvVmZVbm1Ncm4yZHA0NnUydHVLWUdXbHNVZEdwWGNB?= =?utf-8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QS1IvUi84TU1rLy9ZS1hR?= =?utf-8?B?b04wTXRUaURBSXZqdlpmVGlXcnVPejlqaFNiQkJ4SXJBSjFwM0JvMFJNSnVM?= =?utf-8?B?a3RPRW5DUHF2NE1vSUllalJoZnVPakF1RHl5dittUzFWM09YOThieDNQVEp5?= =?utf-8?B?ckRJZjcySVRveVF0TVArMVV1RUwwYm8rdytTR09qMEczOUVVU3RxZHE3a29t?= =?utf-8?B?anBMdTg2MUVYbHFDVGVTM1phalU0WWZOdEFNMkNLV3grMlRTbFd5Vmd4bTVF?= =?utf-8?B?UWhuRU9BQ3lzZFI5eFpERzM3RDVnWm4ydnd1eEViTVpQY3VPNG5hMEt4eUNG?= =?utf-8?B?ZWJmV2NsRERsQVpKeWgyMHVWMWNEY3kxM1BheGtBcHdBSXlJelQ1elJRVGtH?= =?utf-8?B?MWIyRkUvWjJtYXR0Rll2WHpXUFdzSndRRmExT2hoTUdDbUdDbGpTMzVzNUs2?= =?utf-8?Q?rhjQEB1fkO3GhElg=3D?= X-OriginatorOrg: efficios.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7184bbd-8828-4c6b-3e52-08df509e6510 X-MS-Exchange-CrossTenant-AuthSource: YT6PR01MB491026.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 18:02:14.1364 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4f278736-4ab6-415c-957e-1f55336bd31e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Qjk3HVEitFUdVE9K81sX+OPDfWHf5XltEJzqQpULIpMSL+PKmoccy0Fv6BQSJzjSCGPL1i2UXbnEp6MISk65TV8Xp9BTkeyieWF1MA1H0Ew= X-MS-Exchange-Transport-CrossTenantHeadersStamped: YT5PR01MB10882 Hi Juri, On 2026-12-02 15:55, Juri Lelli wrote: [...] > The fixes first; neither is new with this series. > > 1. check_dl_overrun() clears dl_overrun with a plain store, without the > rq lock. [...] > Clearing it under > task_rq_lock() should do (siglock -> pi_lock -> rq lock is already a > valid order, from signal_wake_up_state()). Agreed. The planned next version will have it as a new patch, right after patch 4. check_dl_overrun() will call a new helper, dl_task_clear_overrun(), which clears the flag under task_rq_lock(). > This is also the reason dl_inactive_pending is a bool at the end of > the struct (8 bytes more per task at this point of the series)? With > dl_overrun fixed, it can be a bit like the others. Yes, that was the reason. With your approach below, the planned next version will not need dl_inactive_pending at all. > 2. sched_dl_overflow() admits a task coming back to SCHED_DEADLINE > before its 0-lag time with old_bw = 0: [...] > Discounting it when the timer is active (and, after your patch 6, when > the recorded root domain is this dl_b) would make the two consistent, > and would also close the window where patch 6 counts both. Agreed. It will be the second new patch. A new case of patch 30, params_return_full, tests it. In a partition with no room for two tasks of 60%, a task of 60% leaves the class and comes back before its 0-lag time. Without the fix, the return gets EBUSY. >From patch 6 on, a departed task records the CPU whose root domain counts its old bandwidth. The old bandwidth will be discounted only if the task comes back in that root domain. sched_dl_overflow() will then swap the old and the new bandwidth in one lock section. If the task comes back in another root domain, the old bandwidth is still removed in a second lock section. The cover letter will list that as a known limit. > Could you add these two as separate patches ahead of this one (or I can > send them, if you prefer)? I will add them, with your Reported-by. > Now the approach. IIUC, the only thing a returning constrained task > needs is its deadline. [...] > So, what about keeping the release at the 0-lag time as it is now, and, > for constrained tasks only, clearing the runtime but keeping the > deadline when we release? Yes, this works, and the planned next version will do this. The rule will be a new helper, dl_release_params(), called in the two release paths. The timer restart and dl_inactive_pending will be gone. The patch will add about 30 lines, more than half of them a comment. reenter_asleep_late_in_gap runs the example of the changelog of this patch. The task wakes up at 155ms, after its deadline and before its next period. If dl_release_params() also clears the deadline, the case fails in 3 of 3 runs: the task runs right after its wakeup. With the deadline kept, it passes in 3 of 3 runs. Two details: - "Record the start of the period" (patch 28) adds a field, period_start. Patch 29 computes the next period from it. So dl_release_params() will keep period_start with the deadline. - Your sketch leaves a runtime of 0. A task that comes back before its deadline with no runtime left is not throttled at once. It runs until the next tick, and pays that back at its next replenishment. "Keep the debt of a task across a change of parameters" (patch 29) makes enqueue_dl_entity() throttle it at once. There are two costs, which the cover letter will list: - A constrained task that leaves with much runtime left can reach its 0-lag time before its deadline. If it comes back between the two, it has no runtime left until its next period. Had it stayed in the class, it could have used that runtime until its deadline. - A priority inheritance boost of a departed task replaces the deadline it kept, and the deboost clears it. If the task then comes back before its next period, it starts a new period at once. The priority inheritance series will handle this case. One question. The inactive timer can be armed in one period. Its handler can then wait for the rq lock while the task runs a new period. If the task leaves the class then, task_non_contending() releases the bandwidth at once, as on v7.4-rc2. This is before the 0-lag time of the new period. The root domain can then admit another task into that bandwidth too early. The task itself keeps its deadline, so it gains no runtime. v13 closed this window with the timer restart. Is this window fine with you, or should the planned next version close it? > If you see something that breaks with it, I'd still > suggest splitting the current version: the bail in inactive_task_timer() > for a task back in the class looks like a standalone fix (exit race, > already on v7.4-rc2), then dl_inactive_pending on its own, then the > rule. Reading the state once in task_non_contending() (it is read up to > four times now) would also help. The bail will be a patch of its own, after the two fixes above. As you say, it fixes a race of v7.4-rc2. A task can wake up and die while the handler waits for the rq lock. Its last dequeue then leaves its bandwidth in running_bw and this_bw. The changelog will have the sequence as a diagram. With the rework, task_non_contending() reads the task state twice, as on v7.4-rc2. Patch 6 adds a third read, for a dying task. The full test suite passes on the reworked series. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com