From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81BA5C4332F for ; Tue, 7 Nov 2023 18:50:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234966AbjKGSuj (ORCPT ); Tue, 7 Nov 2023 13:50:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233046AbjKGSui (ORCPT ); Tue, 7 Nov 2023 13:50:38 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98444122 for ; Tue, 7 Nov 2023 10:50:36 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8BF4C433C8; Tue, 7 Nov 2023 18:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699383036; bh=+ZoM+evIxD7mEneiMmjXU5QkrF9RQO8i/R1XbiDrQZ0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=eSCr5Jpz2N5JLw0L9AGG1S1p0Sj335osvqYOXL2HPNTY6xx5zHmgDJhKajxWFl9h4 YQnm2ujHQ1TR7a+zSCLTYZ3HWgxUYUiMIwybRywVPw0zcJCYfDAEbTDN0ttYWyLHiT KY9jVg3bhvw+c3u13luI9DpDuDdpZL3up0dGGq868cWxGzpP1xkLkaMlI92V1PSftJ xwEl7QuddMnCOzah8QnRkcNIwECkKsI2ztcT+TuspqOdVsFO3elNIujfCZiWRMBLEE vafY9njuJdP2XXI45J+9twuVxVeiBR9Hdzwr+hDinXkDMP2HOrNTBci69WG71KlFcP RrXJyk23m6I/Q== Message-ID: <3e58fad7-7f66-4e48-adcc-0fda9e9d0d07@kernel.org> Date: Tue, 7 Nov 2023 19:50:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 6/7] sched/deadline: Deferrable dl server To: Daniel Bristot de Oliveira , Steven Rostedt , Joel Fernandes Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider , linux-kernel@vger.kernel.org, Luca Abeni , Tommaso Cucinotta , Thomas Gleixner , Vineeth Pillai , Shuah Khan , Phil Auld References: <20231107114732.5dd350ec@gandalf.local.home> <7d1ea71b-5218-4ee0-bc89-f02ee6bd5154@redhat.com> Content-Language: en-US, pt-BR, it-IT From: Daniel Bristot de Oliveira In-Reply-To: <7d1ea71b-5218-4ee0-bc89-f02ee6bd5154@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > The code is not doing what I intended because I thought it was doing overload > control on the replenishment, but it is not (my bad). > I am still testing but... it is missing something like this (famous last words). diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 1092ca8892e0..6e2d21c47a04 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -842,6 +842,8 @@ static inline void setup_new_dl_entity(struct sched_dl_entity *dl_se) * runtime, or it just underestimated it during sched_setattr(). */ static int start_dl_timer(struct sched_dl_entity *dl_se); +static bool dl_entity_overflow(struct sched_dl_entity *dl_se, u64 t); + static void replenish_dl_entity(struct sched_dl_entity *dl_se) { struct dl_rq *dl_rq = dl_rq_of_se(dl_se); @@ -852,9 +854,18 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se) /* * This could be the case for a !-dl task that is boosted. * Just go with full inherited parameters. + * + * Or, it could be the case of a zerolax reservation that + * was not able to consume its runtime in background and + * reached this point with current u > U. + * + * In both cases, set a new period. */ - if (dl_se->dl_deadline == 0) - replenish_dl_new_period(dl_se, rq); + if (dl_se->dl_deadline == 0 || + (dl_se->dl_zerolax_armed && dl_entity_overflow(dl_se, rq_clock(rq)))) { + dl_se->deadline = rq_clock(rq) + pi_of(dl_se)->dl_deadline; + dl_se->runtime = pi_of(dl_se)->dl_runtime; + } if (dl_se->dl_yielded && dl_se->runtime > 0) dl_se->runtime = 0;