Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1487066pxu; Tue, 24 Nov 2020 01:12:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJw94NxPQi1YVfQqbaS9ktC+hq7S9UQ0w+SQJM6cSx3yUrtJ/o4+j3g+d2xCo8CZDzhDXN// X-Received: by 2002:a50:8a9c:: with SMTP id j28mr2960472edj.254.1606209154772; Tue, 24 Nov 2020 01:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606209154; cv=none; d=google.com; s=arc-20160816; b=yVyUUkqz5SNP6Jcj2PSUOFFsqF+M/yBn83t7vkA2FU61euxToeToCDXIAu3a0xOJ4C bi+RgtrQSTVEAOQMc0uUIs3jKvEVImfXKwIGAG9GpcF4pPOazHVyUuQkBhgomtZQKBFD KP5uNI/wPyvtUqgLuMCEmuXGM6fyVlyzV+Y7MA3iVmitFfV6PnMZg9CcGmZSl/1jpIIG SRU3o30bDtrrqXQ9BbVWn+zU4PzlLW92kUGgcPNvVeTvCPF7O4La3rHnGghx96VCUr+4 fgbfoMbS4/WQXU6tYLt8FvEnNGI++H9T5AYUq5GDPxSl3/D5oak3c9e141QvoHwS1ike ScDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8Mqfhh5sobw5RQvqH90O9IkiiSzC2XEiEberF8qfFS0=; b=Tfon1PcbKB8+Au8nxhJSDfMzYdhQkPV9ORVNMnZ4g1T64WxdnqDIY3JwXrwSIE7fxx rVbzlUPacc63nQIxssghU7aS4P/nO3f8XuXuQjHOMqob3Aj/1yg3awYw8jurvGZfJBRJ GKOe5Wy+H1bvKl3DwAMIJo26dP8Erl1DSTTtXAKtBwjDW70rGgGqJc+smQZkrY+AJwy0 t6ETSQY5V05Ko6JdyBvtdxA7dO91WfrvVCqOrH6eq9/7cBmkrVZMBwGz9uMjgjjUYwB/ lm8r4k5HUtShMUSyRKr9camGAucEbg0PYuYWztHw3fKAsztdAdg24MvXOfGOLpVytcqM wsBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jGon3Gf+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si9165965edx.51.2020.11.24.01.12.11; Tue, 24 Nov 2020 01:12:34 -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=@google.com header.s=20161025 header.b=jGon3Gf+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730963AbgKXJK0 (ORCPT + 99 others); Tue, 24 Nov 2020 04:10:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730943AbgKXJKY (ORCPT ); Tue, 24 Nov 2020 04:10:24 -0500 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF38C0617A6 for ; Tue, 24 Nov 2020 01:10:24 -0800 (PST) Received: by mail-wm1-x342.google.com with SMTP id a3so2048101wmb.5 for ; Tue, 24 Nov 2020 01:10:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=8Mqfhh5sobw5RQvqH90O9IkiiSzC2XEiEberF8qfFS0=; b=jGon3Gf+LiqEqK0gLdBoozR136wGzvXGvJ1ij5lupny+np0OE0HyWJBTWy87/gD5K1 gZLV7O2sXLiOlm31O//WAmiAFeJ7OkGsr4vhsQjFS6Tj9iImbtb6LOeXO9nKuZlvuHyc Un0nf2CKg/nQnFtfP0XQgVisyCuBm4v1hT3LOAYM8jlITep7MkBNCJQVomyx4bF28IxB kyCxRyRxfSRer5469CV96JS5f++Ro3ARnSifnf7Qmmh+u2athG7nm4zhH/pZ+W+XlQyl ZTP855Lpe6gAo5Z6e3QPoVi4XYSL1gUT9X2HzaWH5IUZpZgXUtpPy0uOhFGsafET+3Ge +liA== 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; bh=8Mqfhh5sobw5RQvqH90O9IkiiSzC2XEiEberF8qfFS0=; b=qyzY6tPDa3CFwrU7JIQfao81+LJqTZobRwNdmlYG/4GqVEmDwA5EZkgT57KeHubi27 qUiHF6m2CYdGTvLRrd5h1Qm3yGuC7hh0mOij79XcUlBShJY2rsjEvJlInx4zeMdbAR63 sAWAJatcFie9QEc7qGke8ZA43g45VPJaztfpYvN73XRp5xvQhKDtMT8unAIe45eyEI9B ItXTqF1ISsM/tAhjd/oQ767RZ5ggAZ+jD5plM4vPrMMwreGaySAJofnW1l3P2d/ASf4c Tsi4nwEqmSqFVK9Be6ZvFJ7ZQc1ROGH+6yrwU86ncljayAksecAHajZ0Tz21vZ8GyPDe n9TA== X-Gm-Message-State: AOAM531I6/Zwem9WtUhyZdhnq1szdGHjo+HrnF8IXO3TacGTpWy6FMNe S27JU6X74DAvvz/DP2AnMnpBlg== X-Received: by 2002:a1c:e455:: with SMTP id b82mr3221302wmh.117.1606209023093; Tue, 24 Nov 2020 01:10:23 -0800 (PST) Received: from google.com ([2a00:79e0:d:210:f693:9fff:fef4:a7ef]) by smtp.gmail.com with ESMTPSA id j4sm23646396wrn.83.2020.11.24.01.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 01:10:22 -0800 (PST) Date: Tue, 24 Nov 2020 09:10:19 +0000 From: Quentin Perret To: Viresh Kumar 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: <20201124091019.GA1023091@google.com> References: <9a5442b916f9667e714dd84fe4e3fc26f8bcc887.1606198885.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9a5442b916f9667e714dd84fe4e3fc26f8bcc887.1606198885.git.viresh.kumar@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, Quentin