Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp587945pxb; Thu, 9 Sep 2021 07:41:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa2LSlsybYiF2IXwwba9MhSHRq6a+ozZzfgwhAmOkPV0oxPLgk//f+QXDmWBSTy6DJrKid X-Received: by 2002:adf:90cc:: with SMTP id i70mr3992705wri.408.1631198506605; Thu, 09 Sep 2021 07:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631198506; cv=none; d=google.com; s=arc-20160816; b=LzpAGcq2fVaCCK5zTZeB0dj3Gc/ytC12zD8CM7v5uGJ4mP0l+FsE9OfDVKtfcUvKed /lD2s5VdZiGkIU+4iA37ELl5RntkgrHw+Vu6oEsOb53t2Xu0ihEtfEbn/mQhFHVNA2eR FqMjATpIjui9upLTMUq/eC18u/4opdrLAit0kKym9w9tu9MycSITo3YvXlCgqgoGeI/e bp+uj4+HVSBKs5CudBm6S32xYh1UM1XJW48XQJN3z+K7UtugUf2K8aXx/Y0kbLEKYu11 PVFKOeDVPl2k0TKvEQYi3nig/oh++EO7DnmG3oiOPWw55Eoo+8b8NDM6P2H4oRKbimgd cvUw== 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=0EkCohunn/+mC/jSWBz15+/M/vV581iWFTVnfu3rN0g=; b=sPDW8gl9TU9qbpIldzwsFtku3FZzKYTnRcc3g2lzsLeGgRw74iU/fYlHSrBBrJM0HY YitxqSjJkFuH+SqDFJWWO23w/WZzShcMWf6S3QEvTBp3AEl0tVRV6BB1GT8b6Gr35m/O MSt+Zg8PcGNcbrYK8gDq9jgxwXK8YNk93mnrc8s5oRyKUYwwDT/oD8n3unAl/NbKaTHu fEMkQxqJ5/KWwlR3Z7U8IKlIoPzhHST1afPCJjne9eR/WlQEIicmet0N8WQgezMNKu2C faPwWHoFLvDt3s3SkNAYvFAHgnlvRheUCNvSbxAyZ920h4p0q1AAiThiEz1EgNkU30v/ DXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MaQiTjjd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si1974606edd.29.2021.09.09.07.41.19; Thu, 09 Sep 2021 07:41:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MaQiTjjd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345977AbhIIOkk (ORCPT + 99 others); Thu, 9 Sep 2021 10:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345692AbhIIOkY (ORCPT ); Thu, 9 Sep 2021 10:40:24 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59BD7C1A2712 for ; Thu, 9 Sep 2021 06:57:49 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id c6so4033164ybm.10 for ; Thu, 09 Sep 2021 06:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=0EkCohunn/+mC/jSWBz15+/M/vV581iWFTVnfu3rN0g=; b=MaQiTjjd6tqU3Ygf6YiUkneCJu9l9HASHDJr/IZplqp1CZptLIuTvRROIdruxn5843 X94MoAbD3WPlQNNgfYuEvRpczID3Vk8dezuz9z2zNzB0+o9sttFoqSLIfIzhKwGozY+G PyxnuguAW5x+vyYHtsniBudhen0erbyHZ6jQB+nhi0TUkDtRxMdxnnktwstX9+rZ0MDp SnCiZDEZ0oSiIUz1h6PYgVmv8R1VALwNlX7PRnAJIgctRnIAMhx+RktvtmDWUGwU7K0Q Iz1RVDw094MizPepF88Ow/mwqV/dkOCXYmO1iWiplHzMo68pPt5JX0AcK9cDbbzW8WM5 unmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=0EkCohunn/+mC/jSWBz15+/M/vV581iWFTVnfu3rN0g=; b=nCinvk42vO43FKb12NUfHRSnsaUCXkB6dRmdgsAdysD2Re1wUoNnHnMs63AcYNpQRy XIKUAezxqB+3oIg6xaJ+j63y27ZXDLCSAhrYjgB5dLineeZ1XvSB94hC3hBeaxFUTw3u wpUom7poNFIJYYAVfPlJDiUjUaIXSiaIowhfTUtvHbtn1+GHP/+d9Kwl90R5/dl83io0 mlGWOQpwi99IaB6Y5j3LweGEv85tePdbaOPD1Qzzan4dl/19IoBbrxPE6x+AutsSbN5m i2EuyJVujWcKrw7cmzw3mkzlc83wq8Gi0F1kCb7fhhwF4CUX4tjMpE/a3ZwcbIJfuq3t F0Cg== X-Gm-Message-State: AOAM531G4pO6bRu5Xo4h5E55C9d3XNoCQyz2JTgsx1HJ5EdSXCw14LtU qXNa/g9jD96w1i+r+YO6fQFbedtRKiY1rLk14zOZJQ== X-Received: by 2002:a25:5645:: with SMTP id k66mr3973824ybb.259.1631195868590; Thu, 09 Sep 2021 06:57:48 -0700 (PDT) MIME-Version: 1.0 References: <20210819175034.4577-1-mkoutny@suse.com> <20210819175034.4577-2-mkoutny@suse.com> In-Reply-To: <20210819175034.4577-2-mkoutny@suse.com> From: Vincent Guittot Date: Thu, 9 Sep 2021 15:57:37 +0200 Message-ID: Subject: Re: [RFC PATCH v2 1/5] sched/fair: Add ancestors of unthrottled undecayed cfs_rq To: =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: linux-kernel , Phil Auld , Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Odin Ugedal , Rik van Riel , Giovanni Gherdovich Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Aug 2021 at 19:50, Michal Koutn=C3=BD wrote: > > Since commit a7b359fc6a37 ("sched/fair: Correctly insert cfs_rq's to > list on unthrottle") we add cfs_rqs with no runnable tasks but not fully > decayed into the load (leaf) list. We may ignore adding some ancestors > and therefore breaking tmp_alone_branch invariant. This broke LTP test > cfs_bandwidth01 and it was partially fixed in commit fdaba61ef8a2 > ("sched/fair: Ensure that the CFS parent is added after unthrottling"). > > I noticed the named test still fails even with the fix (but with low > probability, 1 in ~1000 executions of the test). The reason is when > bailing out of unthrottle_cfs_rq early, we may miss adding ancestors of > the unthrottled cfs_rq, thus, not joining tmp_alone_branch properly. > > Fix this by adding ancestors if we notice the unthrottled cfs_rq was > added to the load list. > > Fixes: a7b359fc6a37 ("sched/fair: Correctly insert cfs_rq's to list on un= throttle") > Signed-off-by: Michal Koutn=C3=BD > --- > kernel/sched/fair.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 44c452072a1b..2c41a9007928 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -4898,8 +4898,16 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) > /* update hierarchical throttle state */ > walk_tg_tree_from(cfs_rq->tg, tg_nop, tg_unthrottle_up, (void *)r= q); > > - if (!cfs_rq->load.weight) > + if (!cfs_rq->load.weight) { > + /* Nothing to run but something to decay? Complete the br= anch */ > + if (cfs_rq->on_list) Could you use !cfs_rq_is decayed(cfs_rq) ? > + for_each_sched_entity(se) { > + if (list_add_leaf_cfs_rq(group_cfs_rq(se)= )) > + break; > + } > + assert_list_leaf_cfs_rq(rq); Instead of adding a loop here you should better jump to unthrottle_throttl= e ? > return; > + } > > task_delta =3D cfs_rq->h_nr_running; > idle_task_delta =3D cfs_rq->idle_h_nr_running; > -- > 2.32.0 >