Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1632709pxu; Tue, 24 Nov 2020 05:26:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwujEkYrDA44NUj0G+mW3/IlvDyDht9f0PKxm97bgEHqgHrNZW2Xes8T9MHbao4XrtWhJRn X-Received: by 2002:a17:906:2850:: with SMTP id s16mr4360166ejc.276.1606224411207; Tue, 24 Nov 2020 05:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606224411; cv=none; d=google.com; s=arc-20160816; b=rsgo0jMOJfDZqI4oLEAiVGS5/ipfmfRh8DDiALVZAdnHAtipsEjJhw6lKvfhhtNkAf 4MkVrH4umsGHDyIybiXrKs7E8GCNw9gpjBg7UMq0v7h2nl311j0BhW++nqjraeLy6i/3 fxSXfgciKMfgGdvL2WQT71wbS3JigpWKCKye/e5kQKh6FgLhNYHwLlAS9dGPnZvokCmE jesCDxRIDnyGEfCakeMGoNiE8VReOj4EweN/9b0QROY+Mo5eCe6iN0ztoC79DFQhq32g Naqkz3h4zbXbbnsN7hyQMIKGgc3iZXtVYVny64EFQODs23ujk9Af2vNeFcRsZzOW9sIU /2jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=e7vSOMbj0zPx6JF2lHClWTW/C5ALeNJny1X9ptSKIck=; b=vSKIhBpMFsnqtO3FrZWNLgbw/sSDvvdjTqYUyyR2Uz00TY9vP7IWEtCHFQoPXjSOiN xksWqjar7nxOf7cRCwsMAK6A7vhl6KQLE1QS7zpeYWy5/F63trphyuCBAGtWDFrdeKER w7+zqqFXrUTSbOuGfzW4XdlPiopmOo8qBsOhSGuR65B0wBdfJFZRJAwAy5w4YmYTRkIK BIcbFuxAPABAe35zzB/meqbAl9hpoZlayL7yg0Inm+OzN4L5u4K2NJsBp4LzPUy5g45E m37CRb8rvxDuPx9tMOKa/GBbd2DmkPvvnYDOcm8wMSKJ6jB/wnKWehOifx0jLxf+JKsa vOTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iDKRgxDe; 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 dk9si789956edb.211.2020.11.24.05.26.28; Tue, 24 Nov 2020 05:26:51 -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; dkim=pass header.i=@linaro.org header.s=google header.b=iDKRgxDe; 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 S2387991AbgKXNWo (ORCPT + 99 others); Tue, 24 Nov 2020 08:22:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387684AbgKXNWn (ORCPT ); Tue, 24 Nov 2020 08:22:43 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A29FCC0613D6 for ; Tue, 24 Nov 2020 05:22:43 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id u2so10676724pls.10 for ; Tue, 24 Nov 2020 05:22:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=e7vSOMbj0zPx6JF2lHClWTW/C5ALeNJny1X9ptSKIck=; b=iDKRgxDeFw+OR0/wRVWW6JX6GHlwYO3QyaedJXmODg7EpiW4f0/pSaFqbDv2k0nQNI 4xhgxoYTsxgJw4TEz6+3bNP5Utc0JB3vxIPt7D6c/BiAvDPctIF7VD/LcCIHlqk/kLIY U57flrzq1ayvFEmhKhpT33DUKzYt8ysf0dEEMXVMLOqsH2nfYmOzmFN+lPHJK1wZc+6X muLL+AXT2mp2poh1c1o6g4nfRrkMcDNkP8mlwtszXnKnlhwc6UOyrRX/4Tym8LbPL0dA B3MxB3SX4WKaC90WqD1U8/UwEjE4F9JHrJyufZavqQhE2u/o9LKFuVjmsXUHMchCjuM2 +mKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=e7vSOMbj0zPx6JF2lHClWTW/C5ALeNJny1X9ptSKIck=; b=tHzLhQQMZ+rWqpcPx+TUopDYJ5na/PRWg+E9VVa0WTrWcYrK1FjFVQRYjDnG2OhwWS +oPVKsrPS+0Vbye41ZHxNmp0V1IxemnwYUdkRsjVW3HRX5EvHO6QPFYvS6mDrlovLL8s vyMpMpxVaLUfgZncUdgGQlkJxIHLnymw4yDmWSDUCpwBx3/sEMbl5v50oiIjfwVMPxPc 0cDQdptj59/Rvk+VtER5yGaZZrK67CiIy5CErq/ofBg607np69Bufj865dZC62iVq/t8 +xuUerMHUL3YMbKSXMVANhN3d8eBH4WQyC3zTU/7glVVYU8qNRtP9q6E3N5q1q8CFb+S z5zA== X-Gm-Message-State: AOAM532GVN4SomwDRtccQ3SuXkiLaQr8OaaYJ3v1ZUhfRyjSI5j5Db/D oK2oOGo+F9JWF0HXrmOtc6AZDKbVTxcJJA== X-Received: by 2002:a17:902:ff0e:b029:d6:820d:cb81 with SMTP id f14-20020a170902ff0eb02900d6820dcb81mr3970370plj.47.1606224162802; Tue, 24 Nov 2020 05:22:42 -0800 (PST) Received: from localhost ([122.172.12.172]) by smtp.gmail.com with ESMTPSA id 145sm13546299pga.11.2020.11.24.05.22.41 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Nov 2020 05:22:41 -0800 (PST) Date: Tue, 24 Nov 2020 18:52:39 +0530 From: Viresh Kumar To: Quentin Perret Cc: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Lukasz Luba , linux-pm@vger.kernel.org Subject: Re: [PATCH V4 2/3] sched/core: Rename schedutil_cpu_util() and allow rest of the kernel to use it Message-ID: <20201124132239.h3kjk6pdwqeoitvb@vireshk-mac-ubuntu> References: <9a5442b916f9667e714dd84fe4e3fc26f8bcc887.1606198885.git.viresh.kumar@linaro.org> <20201124091019.GA1023091@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201124091019.GA1023091@google.com> User-Agent: NeoMutt/20170609 (1.8.3) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24-11-20, 09:10, Quentin Perret wrote: > Hey Viresh, > > On Tuesday 24 Nov 2020 at 11:56:15 (+0530), Viresh Kumar wrote: > > There is nothing schedutil specific in schedutil_cpu_util(), rename it > > to effective_cpu_util(). Also create and expose another wrapper > > sched_cpu_util() which can be used by other parts of the kernel, like > > thermal core (that will be done in a later commit). > > > > Signed-off-by: Viresh Kumar > > --- > > include/linux/sched.h | 21 +++++++++++++++++++++ > > kernel/sched/core.c | 11 +++++++++-- > > kernel/sched/cpufreq_schedutil.c | 2 +- > > kernel/sched/fair.c | 6 +++--- > > kernel/sched/sched.h | 19 ++----------------- > > 5 files changed, 36 insertions(+), 23 deletions(-) > > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > index 063cd120b459..926b944dae5e 100644 > > --- a/include/linux/sched.h > > +++ b/include/linux/sched.h > > @@ -1926,6 +1926,27 @@ extern long sched_getaffinity(pid_t pid, struct cpumask *mask); > > #define TASK_SIZE_OF(tsk) TASK_SIZE > > #endif > > > > +#ifdef CONFIG_SMP > > +/** > > + * enum cpu_util_type - CPU utilization type > > + * @FREQUENCY_UTIL: Utilization used to select frequency > > + * @ENERGY_UTIL: Utilization used during energy calculation > > + * > > + * The utilization signals of all scheduling classes (CFS/RT/DL) and IRQ time > > + * need to be aggregated differently depending on the usage made of them. This > > + * enum is used within sched_cpu_util() to differentiate the types of > > + * utilization expected by the callers, and adjust the aggregation accordingly. > > + */ > > +enum cpu_util_type { > > + FREQUENCY_UTIL, > > + ENERGY_UTIL, > > +}; > > + > > +/* Returns effective CPU utilization, as seen by the scheduler */ > > +unsigned long sched_cpu_util(int cpu, enum cpu_util_type type, > > + unsigned long max); > > Are 'type' and 'max' useful to anybody outside of kernel/sched ? > If not then how about we hide them, keep the cpu_util_type enum in > kernel/sched/sched.h and evaluate arch_scale_cpu_capacity() in > sched_cpu_util() directly? cpufreq_cooling uses 'max' (as can be seen in the next patch). -- viresh