Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9251190rwr; Thu, 11 May 2023 12:06:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4U2M6o+noI0jk+CdgeOYk0ONJuR14n8XlMQb/JUUiRAUf4Y8ShJxbwTHIKZn6mqDUljtvC X-Received: by 2002:a05:6a20:8416:b0:ec:d7cf:bcf7 with SMTP id c22-20020a056a20841600b000ecd7cfbcf7mr27736099pzd.17.1683831960023; Thu, 11 May 2023 12:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683831960; cv=none; d=google.com; s=arc-20160816; b=JQeIUTUNba7WJRnFuIIGPO8DmkIB2seeGj6oEAuP6BaeSwewMQdWr5ABVKgZ/q610w m1HH3cTee7/qP/0nHH77+od630v+RYn86/ZTrbs9/htyfffIUBpIW3j3dEYMYG2vOD2Z bblXEhktZ2KxlskQ109Q2p/qmyZqSYG/zcFeiOnq8njTNDv+MhujolRUleQqt+3Ufs3q PcKp7WADdKegKIpiRIb+7KDiGezKjhVQ2xJhpXY4RQ7+dsSoXIOEIuQyGnG0uUdASL8z BdWzCBxBYNHqVMz2+TYtAmduXEJDjpnJZkLWxBK9qHE5YqKK7pDbYdVKo6W79IL4V/pS GwEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bWM1jp+eGvaqbsAh0eljWb7kApkfVmgcMHgGBYQZHSA=; b=Engk17GyRgB9dBJjpvfg/LA52HBoDEBxxsf1Mr7gMppvpbhfvohNoAZciIbmre8ZqQ ZXb/LoypTVbWaCNDPvRH7nH/Ow6QurARPI/Xxr8aFmrGcHhz2ESocOgj9Z0uQjhOsnsX DdQiY5D6uzPTHBeJXluWEpjoAoesfEtVVWv8iRzAtgLQSj7dzNJSkg8bBFTTlCBDj3Qg 8YoJkJluhYt1sA2LU8I9+dIZvJphLeJQ60UYw7BQFFmf+S1YZSVl3zR7M1Q3qaa795IV KHkUI+IumaubL/jOL0gf2bSKjQBDolY5QIAa2hte3IeGgFOGVJCQlQbft9RDjWbAtrYj 8gWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bitbyteword.org header.s=google header.b=GgloZoW2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a633602000000b0050bfa82c23bsi6953691pga.230.2023.05.11.12.05.44; Thu, 11 May 2023 12:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bitbyteword.org header.s=google header.b=GgloZoW2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238927AbjEKSz4 (ORCPT + 99 others); Thu, 11 May 2023 14:55:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238906AbjEKSzy (ORCPT ); Thu, 11 May 2023 14:55:54 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D54272BB for ; Thu, 11 May 2023 11:55:53 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-6aaef8ca776so2394878a34.2 for ; Thu, 11 May 2023 11:55:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bitbyteword.org; s=google; t=1683831351; x=1686423351; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=bWM1jp+eGvaqbsAh0eljWb7kApkfVmgcMHgGBYQZHSA=; b=GgloZoW20h5o6vrR1LE41TasgCd5QxHVF4k+Yg8PDrsYtPXvGiyKNlzekAFTv1Burv kp1qiAXhTQJQumU00gqBboSeP+CqWLRCBksA3U44VRfpjbez66PefpE0DjmCcc+z1lm2 elyKq5Ehhqeoy6DsHwLIAxeLRQnXKJm3H0K4nV0eRK73w25GJBYlNOge/+4gsahweYfV Kp1GHbHC3fspqw9LsE/v/PG+wSb3vdIPTn9u4vNf88lhAtQqnsmgYUP8gJ1wcamgpVjZ 8kPR9v6MuN+ilshxJ1HvhurI9G0ILD+Fk5O9c9aA5YgJAR4tOiW2YoqgybcYYY5UUvKI d68g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683831351; x=1686423351; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bWM1jp+eGvaqbsAh0eljWb7kApkfVmgcMHgGBYQZHSA=; b=gFZRjjW1HkbHWKynU36BwqSgMn40rWDIW/jVejoJ0JJ7LFd8FTWaU19A6YvkyQy5Q+ igfWyCrskh3RG0qRSEwnLPXs+Swi6tNMAkWoa/jOK4ZlE680XSwmtQSQCPyylJZwZHen jlBxDu2H3WicSVh6/27KnNCm/X8CR8sCp3aF7S9GMu2o5vFokZrm4Fdu3yI/GQ1WB19m CMM3TccnHzZ58HY1BjY8qI7viCQZU0vB46MJagOy3OoDuOzctHatQIc2sz6bUJ8RaoGj REKv0cWbvyBxsHSAceHNQs/3b8a+rJ0GowCHyqHiDOK3p6hTC75zxcLi4gJVBDuRq09D bUyw== X-Gm-Message-State: AC+VfDxN7LI+JRqFFFT/u1vj5RKTYlUCqK93Ow71rEgqLuhkhGBgyfwH iz/WzCdbJM+39WoMkIFJ04UWC1SVO0pid9xGPDADJw== X-Received: by 2002:a05:6808:6087:b0:38f:76d7:38cb with SMTP id de7-20020a056808608700b0038f76d738cbmr5025661oib.0.1683831351468; Thu, 11 May 2023 11:55:51 -0700 (PDT) MIME-Version: 1.0 References: <20230511014625.3443409-1-vineeth@bitbyteword.org> In-Reply-To: From: Vineeth Remanan Pillai Date: Thu, 11 May 2023 14:55:40 -0400 Message-ID: Subject: Re: [PATCH v2 1/2] sched/deadline: Improve reclaim bandwidth accuracy for GRUB To: Joel Fernandes Cc: luca.abeni@santannapisa.it, Juri Lelli , Daniel Bristot de Oliveira , Peter Zijlstra , Ingo Molnar , Vincent Guittot , Steven Rostedt , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider , Jonathan Corbet , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Joel, On Thu, May 11, 2023 at 2:19=E2=80=AFAM Joel Fernandes wrote: > > Hi Vineeth, > Nice work. ;-) Few quick comments below: > Thanks :-) > On Wed, May 10, 2023 at 6:46=E2=80=AFPM Vineeth Pillai wrote: > > This patch fixes the issue by appropriatley caping the max allowed > > utilization and also slightly adjusting GRUB algorithm to account > > for a mix of normal deadline and SCHED_FLAG_RECLAIM tasks. > > Looked at the patch quickly as I am due for bedtime ;-). I feel like > this does more than should be done in one patch. So you should > consider splitting it IMHO. I think the explanatory comments are what makes this patch look huge. The code changes are pretty small and simple: - track bw of SCHED_RECLAIM_TASKS - modify the reclamation equation. > > According to the GRUB rule, the runtime is depreciated as a factor > > of active bandwidth of the runqueue: "dq =3D -dt", where U is the > > Saying "dq =3D -dt" where U does not make sense because U is not in the > equation ;-). Suggest rephrase. > Sorry about this, I will rephrase it. > > > active bandwidth. Also, we do not allocate the full bandwidth of a > > cpu to deadline task, but only a portion(Umax) to it, so as to avoid > > deadline tasks starving lower class tasks. The equation could be > > re-written as "dq =3D -(U / Umax) * dt" > > Isn't the equation in the code right now as: > dq =3D -max{ Ui / Umax, (1 - Uinact - Uextra) } dt > > ? > > That's what the kernel docs say [1]. > > So what do you mean by "could be re-written" ? > > [1] https://docs.kernel.org/scheduler/sched-deadline.html > This patch uses a different equation than [1] and updated the kernel doc as well in patch 2 of this series. I understand "re-written" is confusing and will rephrase it. > > Following are the results with this patch: > > > > RUN 1: runtime=3D7ms, deadline=3Dperiod=3D10ms, RT capacity =3D 95% > > TID[616]: RECLAIM=3D1, (r=3D7ms, d=3D10ms, p=3D10ms), Util: 94.98 > > TID[616]: RECLAIM=3D1, (r=3D7ms, d=3D10ms, p=3D10ms), Util: 95.04 > > TID[616]: RECLAIM=3D1, (r=3D7ms, d=3D10ms, p=3D10ms), Util: 95.01 > > All these look 100% correct to me. Do these tasks start at the same > time or are they shifted in their respective activations? Just wanted > to be sure it behaves the same either way... > I have tested both. Actually I tested 3 scenarios: - Started the threads at the same time - Started the threads separately (5-10 seconds apart) - Started the threads at the same time with some of them sleeping for a while before spinning. This was to see if transition from NonContending to Inactive was showing any issues with this patch. > > +static inline bool dl_entity_is_reclaim(const struct sched_dl_entity *= dl_se) > > +{ > > + return dl_se->flags & SCHED_FLAG_RECLAIM; > > +} > > + > > Can this helper addition be split out to a different patch? > I feel it could go with this patch as the code changes in this patch are fairly small and the function is trivial. But I can split it if you feel that this patch is really huge and needs splitting. > > + * Maximum available bandwidth for this runqueue. This is used = to > > + * calculate reclaimable bandwidth for SCHED_FLAG_RECLAIM tasks= . > > + * By restricting maximum usable bandwidth, we aim to give othe= r > > + * tasks on lower classes a chance to run, when competing with > > + * SCHED_FLAG_RECLAIM tasks. > > */ > > - u64 bw_ratio; > > + u64 max_bw; > > + > > + /* > > + * Active bandwidth of SCHED_FLAG_RECLAIM tasks on this rq. > > + * This will be a subset of running_bw. > > + */ > > + u64 reclaim_bw; > > + > > And perhaps addition and use of these new fields if it makes sense. > > I will take a closer look at your patches later or after v2.. > Thanks :-) Vineeth