Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp281027ybf; Wed, 26 Feb 2020 13:02:28 -0800 (PST) X-Google-Smtp-Source: APXvYqxVY0nPa31xmjaYSZ1aHGeCzvJOABpDeuuo33HCiSkqyOdCKWteDWCbAi8Z6tbPw0LQ38TM X-Received: by 2002:a9d:2184:: with SMTP id s4mr524241otb.121.1582750948226; Wed, 26 Feb 2020 13:02:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582750948; cv=none; d=google.com; s=arc-20160816; b=tNhgHptx9UNiHm1+RCYQU0RKSbmIDM0oG/lc1YPH9f63E41U+TURtYA23zeYgweVOo 8V+jpbQzOAF1jrq4oebnmxMzFfQMnSBZs8QvgtySL0plvGRau+LIMQCuDhwDJp9vykbB HByJt1lrg4qhl2Z8VhP/s6zM9nYkxp4/oNTtx8aRYpQr2d2dkNyx2Q1zmvgVf4EZBAeH Cvms5W7FrQblrkwffQSSAgHJcaxm0G8Ih4bQC931ZOvB5EdOQ549d10PbJ+3mXUHZVq6 5HduusVNWYvZGRurY+PQ0KELq2ZiE6rXzh8+7RuzsrI2QR1reh69TtNGH2LRPrKVW+cQ FbtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cxtTUuGGBnBqk8GWMEJkzjvxvt2ATxKqyf/9k5yzLHE=; b=BR8QfHvzLbko1GN2ValGh1g7dlgXUVDnHeY6dy/7G3wB/L2fqSjDK6+0w6Q6vGLg1i desSoVWztjbJdtOpEAWxLIIjt8mvYghbv4cGBILMp+XAGCpfhFlZ/blmetHl9XVxhWKf seN8h57oZQT5uz6OuZUvufTJy39ZJs0/xfeh2sj7r0NvWh2fbKstgcYO3V4mE1AapkGS +9VugrLmsIzvoCyQKAIba9dt3O7ruT7dM/XodT3Zjiuffe5uVIDWxkzhgobpafbs3wDm ntVnN5og37OLXMBhnnmjsEcWTx41xo6LhcI4ccSY2m+xbMOz1Wdwf58ycz3qbNx9MbSp 6qLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nD60SHOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id k19si378636otr.52.2020.02.26.13.02.15; Wed, 26 Feb 2020 13:02:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nD60SHOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727491AbgBZVBu (ORCPT + 99 others); Wed, 26 Feb 2020 16:01:50 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:44946 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727387AbgBZVBu (ORCPT ); Wed, 26 Feb 2020 16:01:50 -0500 Received: by mail-lj1-f193.google.com with SMTP id q8so674066ljj.11 for ; Wed, 26 Feb 2020 13:01:49 -0800 (PST) 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; bh=cxtTUuGGBnBqk8GWMEJkzjvxvt2ATxKqyf/9k5yzLHE=; b=nD60SHOSpqxspfYMC9aWPBFxLAJXqr6Yy1qW6p1B8fZoz2oUyPFSw7I/VIP3k86D8h Trh/TLD2ys5h4iUROAlqoE4asrTwTXm/tMBGuRF9mTD2VT46M3knvGbvIG/HAehc9lji 7B/1KRk9RPs7ppfaj8kd3fyPLVz0qAcuhX7rVfOpyDOVNLuryvmCv+QscjYRcIxtksUb qaKZlf84rkHfpu8fDxzkf+0f2QecafcC7faKW546HcRnLyRVEuOSDGPnOrihbKsVKOW6 hiXem2JoUJ8+VcwYfs2aL0y+78WRIHR3LzkxWsF4cQoAXvYgX6AMUof0iQzZPA6Wzzad iACQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cxtTUuGGBnBqk8GWMEJkzjvxvt2ATxKqyf/9k5yzLHE=; b=ejwwpI7zzDnLTAxiMvOMaoOmG2crXtxU1JHO6oVFVWjpticdspmGl3p6Y5145yXTiC R0SDkqjySqhrdxTE4Nn9hNJMMY3VPH3+RogXApmwWtLNHOvXbavMDjk1/hEA1p4k9i4G sR/KnvXOcp/VCPfecQRgYiLlqKY/5coUd/ba4KRUQLykzZ2X0LKHbSSe4sLjHkucstJA l95f6wWdt9nccytMEhR0fXk2nuv4aAsGBmA0gK1oMfrT/nw4oNkEubsXsEqn/gGvw+wY GRVyZt4ioeIBuC6XzTP+FOOvzIUySwI1g8QhiAjvokAGsHrCBJyXu/jysQKX7s4lc5aK WiQQ== X-Gm-Message-State: ANhLgQ11Cj4BNFAPSOT1K/jEvTRw9KaQIQGFoewTsq45ZH/I4MIWudWm x1Qg+gaygXQnA0MNU6py1RC2I6sweCxUN92zV+VsiQ== X-Received: by 2002:a2e:8699:: with SMTP id l25mr508265lji.137.1582750908551; Wed, 26 Feb 2020 13:01:48 -0800 (PST) MIME-Version: 1.0 References: <20200226181640.21664-1-vincent.guittot@linaro.org> In-Reply-To: From: Vincent Guittot Date: Wed, 26 Feb 2020 22:01:36 +0100 Message-ID: Subject: Re: [PATCH] sched/fair: fix runnable_avg for throttled cfs To: Ben Segall Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Mel Gorman , linux-kernel , Phil Auld , Parth Shah , Valentin Schneider , Hillf Danton , zhout@vivaldi.net Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Feb 2020 at 20:04, wrote: > > Vincent Guittot writes: > > > When a cfs_rq is throttled, its group entity is dequeued and its running > > tasks are removed. We must update runnable_avg with current h_nr_running > > and update group_se->runnable_weight with new h_nr_running at each level > > of the hierarchy. > > You'll also need to do this for task enqueue/dequeue inside of a > throttled hierarchy, I'm pretty sure. AFAICT, this is already done with patch "sched/pelt: Add a new runnable average signal" when task is enqueued/dequeued inside a throttled hierarchy > > > > > Fixes: 9f68395333ad ("sched/pelt: Add a new runnable average signal") > > Signed-off-by: Vincent Guittot > > --- > > This patch applies on top of tip/sched/core > > > > kernel/sched/fair.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index fcc968669aea..6d46974e9be7 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -4703,6 +4703,11 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) > > > > if (dequeue) > > dequeue_entity(qcfs_rq, se, DEQUEUE_SLEEP); > > + else { > > + update_load_avg(qcfs_rq, se, 0); > > + se_update_runnable(se); > > + } > > + > > qcfs_rq->h_nr_running -= task_delta; > > qcfs_rq->idle_h_nr_running -= idle_task_delta; > > > > @@ -4772,6 +4777,11 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) > > cfs_rq = cfs_rq_of(se); > > if (enqueue) > > enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP); > > + else { > > + update_load_avg(cfs_rq, se, 0); > > > > + se_update_runnable(se); > > + } > > + > > cfs_rq->h_nr_running += task_delta; > > cfs_rq->idle_h_nr_running += idle_task_delta;