Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1452173ybf; Thu, 27 Feb 2020 11:14:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzhSlFRwGGZ3+vygsx8cyOoN7nrZK1Zr8hmAoGsnxThd6lY5rSZRGQognBJaO0Pgqrhkl0B X-Received: by 2002:a05:6830:1f0c:: with SMTP id u12mr301758otg.253.1582830862195; Thu, 27 Feb 2020 11:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582830862; cv=none; d=google.com; s=arc-20160816; b=wIdUSUtYZZjdxuT4cQmtEwV22fdVF7g80O/JxLw564LPuytjfKEX20558p4y0GC3rv dl7Xn2xNJG+Me6TTCtEhXjLlrHSIGQsvkx0rQ79r/6K+U18Zk2FMHrEy5nDAboM0Lqb6 YN+A6IqXt4YqHNJb4+0B7uWSQ0+gbKY3Kjm845DfpbDbzZcx6iM4nZMh711zCqhqMaNG 0eoU/2s+UPz9iZ6MsRubwf72PA3MyHAqOXLoDSRL7ch4XjSYFLl3H36qXdNr5uNJvd6W EqUeO8dTY8/Fe2+mldgtg4Cbdg9wgHHgmpbgrxK4J9AlT7ejGt6pSANQ4mv+IuG5zNkR VqNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature; bh=ltWk1OgooA+fGQ205Nk5s6jGGfXx7mNf2yLqJVxcgnw=; b=Qrff0U2v1e4N0zp/mMgn3mL7cwOsmKZ57R9rJA4XidLpDP1Nd2e9E5NE/K4Ygnl5wK BZ1qchqueCz4T4e36fQL6isHB2K1V7jV+Jf6tkMn+eWO6VMbCeLjqtD1jLzjtjRLQvpZ N5P94xcHtVQr1wPdPwWaWa9v5VOElj+j1mtipcX91AXRzeRK06IxeMUIHf+xTwHYKPja YdAlZAplOMfVTa9HlNbWVQ+bNHvZZlQtifeW5POTIcEPs0P2DhYfnxRKqud4w7X3kzsP 6cM2rk/6DyMAw1VDKiWpeIH41ovWKHY08pE9JHUGlkThrbn+iUb6PBTImreYZ60aRK/X I2Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Rp8AVLzq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h138si406659oib.6.2020.02.27.11.14.10; Thu, 27 Feb 2020 11:14:22 -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=@google.com header.s=20161025 header.b=Rp8AVLzq; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729915AbgB0TOC (ORCPT + 99 others); Thu, 27 Feb 2020 14:14:02 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:54821 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729327AbgB0TOB (ORCPT ); Thu, 27 Feb 2020 14:14:01 -0500 Received: by mail-pj1-f67.google.com with SMTP id dw13so192757pjb.4 for ; Thu, 27 Feb 2020 11:14:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ltWk1OgooA+fGQ205Nk5s6jGGfXx7mNf2yLqJVxcgnw=; b=Rp8AVLzq1CPKtYmNKrPMUXgzzx33DJcSPvqTOL4EobIGFP3mlVvRq/kmIftdAuLdqZ 4CUgUF3a0750hfUoEocFn3lYwRJ6T+320TTMqBaU1UliyjjIQ8l9TH9Q0m4i/0QL++FS mJwHjxNete5q+zMFfTTXQSRJ0LTl5+TXzNtsUqEZx2ye4Lo0c52cii/hQ9HkqKwUUbVi Ek4J4z5AfzIJ70QsQ6YZXD2oEoC3udFYuL2FEnZgkvPMyd5QqNgLsKGdFw1eBIUfWdqE IM5CqkVKD7NAqWjYMTpRVA0h3XlGXJV2cIRWLLqbqW2xTQ3ChohQFQPU1aI+yvBuvxp5 IEdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=ltWk1OgooA+fGQ205Nk5s6jGGfXx7mNf2yLqJVxcgnw=; b=IysjTYleVVKVMSTeenRA4i7EVOtK2aDnJPKxyGU6TjMg63J77Te/x4OKdvgwfG20HE pmCSF/aFWOvyecRr+QoZuAwXTDIB6ufy7TXlaPI3CrNMeMD/ozFMlbBvddz/VVUsRB82 izcG4TnmDV2ohlQsp96eJB3/cteMwKVOG4kHdSqxnHG0whZsKoxxRvdRlDoDz/HJSOnc j//CnrhuzTvfQkWeql3sHsObh+nCzS/Q1Db6LPrrgCs7DJRD2iRXtZsWLVnB5NRS32VE Zv0ErHM+BNwJBstjbmRyUnWHtUdocKob9rNKRpXngntjKsuEG5PpYieAB/7RC3hDxoKJ pDig== X-Gm-Message-State: APjAAAU2epkedyq0PnGP3560wYZ7NOH5vMWbxlZPLmFqOK7A/tyEMaOC JczEuJ5EXYVXdbii5LhuMV5iMQ== X-Received: by 2002:a17:902:9889:: with SMTP id s9mr246741plp.252.1582830840604; Thu, 27 Feb 2020 11:14:00 -0800 (PST) Received: from bsegall-linux.svl.corp.google.com.localhost ([2620:15c:2cd:202:39d7:98b3:2536:e93f]) by smtp.gmail.com with ESMTPSA id r8sm7148844pjo.22.2020.02.27.11.13.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 11:13:59 -0800 (PST) From: bsegall@google.com To: Vincent Guittot Cc: Ben Segall , 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 Subject: Re: [PATCH] sched/fair: fix runnable_avg for throttled cfs References: <20200226181640.21664-1-vincent.guittot@linaro.org> Date: Thu, 27 Feb 2020 11:13:58 -0800 In-Reply-To: (Vincent Guittot's message of "Wed, 26 Feb 2020 22:01:36 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vincent Guittot writes: > 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 Right, I misread what exactly was going on. > >> >> > >> > 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;