Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2653345pxb; Tue, 23 Feb 2021 12:04:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJpo9YWYb6FOiVacp04SmDxWCAaAG8iooZuviW51g9EXe8kRbpYWC7vT6DCBNcp8zYz0yL X-Received: by 2002:a17:906:404f:: with SMTP id y15mr2696ejj.517.1614110683322; Tue, 23 Feb 2021 12:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614110683; cv=none; d=google.com; s=arc-20160816; b=MwO4wg3xK1USbHbAVM7o4CnWoq67FM9Iq0f4+E3ZzcN/BvyRdePVnmLVLmc5PKMgbW nluPxDjho8ABlbO/2qeVLEcOe+o7bfyy8QpPjCkDJTxwP05wmYWD/yzqs5XCcEowtDyg 8+dKpeCJmFjaMvO++DcS65pXdRW/U0Hqv85uR0WryI1yPYsEsmoAvi2GhE9u41YGenoV 8Ozt0tkEDWQuEZ+4ixbszfdDemYSZNlLk8u8wMJwf8F15nfrw7U/5ZOstCzg4pPDd6zg dMkHrfRNrorOqtzAPXt90v4JQT8dVuPJ/uay8Q4ByOA0n4bPLPnc7fafaFAq5QDGi0hY 7dOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=fBn9+mqK9xKtn7UKFkyVyFLGOut1voCC+tAw4vYnr4A=; b=bUSHrE3wIP44z+mR7IPw/Y5vsuoEAzsyTW7vcoxssWbDlHI3UbY4sV7ki67AmJV7BA AsJeIMUFQy3c/VxDk18othcxwvogr4of8ahteVwXcn6Yr6+ZipzHhNLmIqsVHMZBzNER JRzsBNWZjcsHn/fxa72mBO+gjR5zeu6avkF+vkSN8OaxDK1Ud7kbtdsAv8UKNpvtYk+d lVLZXI3mOW1JaTjXGN2blYdwqbmwGHoEgsLiXX9leom03uX/t4TYHHxNyZp32UR1uUFg GT5XoIf+CROx7QVUO5w7UkdhbMc3fwGpc8H63sD5V+YfB28+2l/6DQ1AwzcKZ5o9YXSQ Cjjw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do5si14105478ejc.441.2021.02.23.12.04.02; Tue, 23 Feb 2021 12:04:43 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233087AbhBWOsq (ORCPT + 99 others); Tue, 23 Feb 2021 09:48:46 -0500 Received: from foss.arm.com ([217.140.110.172]:53836 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232553AbhBWOsj (ORCPT ); Tue, 23 Feb 2021 09:48:39 -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 9F4961FB; Tue, 23 Feb 2021 06:47:53 -0800 (PST) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 29A643F73B; Tue, 23 Feb 2021 06:47:52 -0800 (PST) Subject: Re: [PATCH] sched/fair: Fix task utilization accountability in cpu_util_next() To: Quentin Perret , Vincent Donnefort Cc: peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, patrick.bellasi@matbug.net, valentin.schneider@arm.com References: <20210222095401.37158-1-vincent.donnefort@arm.com> <20210222113602.GA286874@e120877-lin.cambridge.arm.com> <20210222150151.GA124800@e124901.cambridge.arm.com> From: Dietmar Eggemann Message-ID: Date: Tue, 23 Feb 2021 15:47:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/02/2021 17:23, Quentin Perret wrote: > On Monday 22 Feb 2021 at 15:58:56 (+0000), Quentin Perret wrote: >> But in any case, if we're going to address this, I'm still not sure this >> patch will be what we want. As per my first comment we need to keep the >> frequency estimation right. > > Totally untested, but I think in principle you would like something like > the snippet below. Would that work? > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 04a3ce20da67..6594d875c6ac 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6534,8 +6534,13 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd) > * its pd list and will not be accounted by compute_energy(). > */ > for_each_cpu_and(cpu, pd_mask, cpu_online_mask) { > - unsigned long cpu_util, util_cfs = cpu_util_next(cpu, p, dst_cpu); > + unsigned long util_freq = cpu_util_next(cpu, p, dst_cpu); > + unsigned long util_running = cpu_util_without(cpu, p); Wouldn't this be the same as: unsigned long util_running = cpu_util_next(cpu, p, -1); except some different handling of !last_update_time and 'task_on_rq_queued(p) || current == p)' in cpu_util_without() which shouldn't happen in EAS. We have quite a lot of util related functions! [...]