Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp998641ybf; Thu, 27 Feb 2020 03:20:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxcw7RWYfR4HTcJ5a+v8VWi1yORKXFvjtM4nZSi4mlhPjHST77BdM1fK9dmfeBNS2zWjfrh X-Received: by 2002:a05:6808:99c:: with SMTP id a28mr2748166oic.164.1582802455083; Thu, 27 Feb 2020 03:20:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582802455; cv=none; d=google.com; s=arc-20160816; b=TgqR4NznBtS9/9J7YeRJxyzikrHzTsRXRXU+qlI4x+cEPQmV4Kr7jzFZJZdQoHmfj8 +Wwh87qiy/keEGfv2tVhKhjjCkpFYER0o14jMIhh9hAXX+KreW95DwcW9eBYk9ePayVF nsEA/WiXsRPhpJR7ShSgJxZM/oUfwV/wgO1a0rt6QvGrg0GkKKlqwu/RMQwE4KTlEegM cS6YvcRS+EcRP+Hfb81e6SHxtlPp6+z3Lz0IchQ9aErvlWeTOkol446O/HX1CMIxlu91 Tm8zTgdtBgH2Ts1vEz6DS0WeeQs0FDuHT9bJx8ip1NKy8igEq6dA2aNwiMKS9qKBW/wD itIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=mwsve8aBlvQoNxE7I+dZWZRLrWmrfP055h30To3mVYg=; b=nCDenS1OMx5b1RlzNZWTu8q3EUp6ON91Opaj0jhLEH05DWILupBQX9gJVu4bX6J7Na GRVtZwZIAgzXpssR3gq0HqrCMkiVXXIkaPa1/fkJIOmkKEdfap2ZwifvP7G4+dF8urdE FsXhCi+clPs1hmiPNHh6PG1YtbiYrWpLCeRPOZaSNs09VFdnO9ADatd5cRjHECocKuqq pRs5+DeVbEiypsUgaNJMXQNHBR8nGDWMKR4+LsNhqottgi6dZOvyzRK0Oy0cPsH5nCWp RwpOi/EYGxezIHdJueZR+qv9dtMv3zIAMG6tzxXR4VGsGp1dcCzSZJOX/ErU6Ygeff/K +Ipg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si1126677oie.50.2020.02.27.03.20.42; Thu, 27 Feb 2020 03:20:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728874AbgB0LUS (ORCPT + 99 others); Thu, 27 Feb 2020 06:20:18 -0500 Received: from foss.arm.com ([217.140.110.172]:48820 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728846AbgB0LUS (ORCPT ); Thu, 27 Feb 2020 06:20:18 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A8B9B1FB; Thu, 27 Feb 2020 03:20:17 -0800 (PST) Received: from [10.0.8.126] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 018F93F73B; Thu, 27 Feb 2020 03:20:15 -0800 (PST) Subject: Re: [PATCH] sched/fair: fix runnable_avg for throttled cfs To: Vincent Guittot , Ben Segall Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt , Mel Gorman , linux-kernel , Phil Auld , Parth Shah , Valentin Schneider , Hillf Danton , zhout@vivaldi.net References: <20200226181640.21664-1-vincent.guittot@linaro.org> From: Dietmar Eggemann Message-ID: <8f72ea72-f36d-2611-e026-62ddff5c3422@arm.com> Date: Thu, 27 Feb 2020 11:20:05 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26.02.20 21:01, Vincent Guittot wrote: > 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 ^^^ Shouldn't this be 'current' rather 'new' h_nr_running for group_se->runnable_weight? IMHO, you want to cache the current value before you add/subtract task_delta. >>> 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;