From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756922AbdLPQkD (ORCPT ); Sat, 16 Dec 2017 11:40:03 -0500 Received: from mail-ot0-f194.google.com ([74.125.82.194]:34871 "EHLO mail-ot0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756368AbdLPQkB (ORCPT ); Sat, 16 Dec 2017 11:40:01 -0500 X-Google-Smtp-Source: ACJfBouvDAnBn0uEEEc5De+bTg/7uwgnBal4jc3ye+bqDqC2Wag2PSWvkr3Tzwh2IqfyHqn0gXCTi4pnjyS/t/FKf4E= MIME-Version: 1.0 In-Reply-To: <17ff0b5d83a1275a98f0d1b87daf275f3e964af3.1513158452.git.viresh.kumar@linaro.org> References: <17ff0b5d83a1275a98f0d1b87daf275f3e964af3.1513158452.git.viresh.kumar@linaro.org> From: "Rafael J. Wysocki" Date: Sat, 16 Dec 2017 17:40:00 +0100 X-Google-Sender-Auth: 4GqlfFJyDbCkb-AZkZPpRmBNQn4 Message-ID: Subject: Re: [PATCH 2/4] sched: cpufreq: Keep track of cpufreq utilization update flags To: Viresh Kumar Cc: Rafael Wysocki , Ingo Molnar , Peter Zijlstra , Linux PM , Vincent Guittot , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 13, 2017 at 10:53 AM, Viresh Kumar wrote: > Currently the schedutil governor overwrites the sg_cpu->flags field on > every call to the utilization handler. It was pretty good as the initial > implementation of utilization handlers, there are several drawbacks > though. > > The biggest drawback is that the sg_cpu->flags field doesn't always > represent the correct type of tasks that are enqueued on a CPU's rq. For > example, if a fair task is enqueued while a RT or DL task is running, we > will overwrite the flags with value 0 and that may take the CPU to lower > OPPs unintentionally. There can be other corner cases as well which we > aren't aware of currently. > > This patch changes the current implementation to keep track of all the > task types that are currently enqueued to the CPUs rq. A new flag: CLEAR > is introduced and is set by the scheduling classes when their last task > is dequeued. When the CLEAR flag bit is set, the schedutil governor resets > all the other flag bits that are present in the flags parameter. For > now, the util update handlers return immediately if they were called to > clear the flag. > > Signed-off-by: Viresh Kumar > --- > include/linux/sched/cpufreq.h | 7 ++++++- > kernel/sched/cpufreq_schedutil.c | 21 ++++++++++++++++++--- > kernel/sched/deadline.c | 4 ++++ > kernel/sched/fair.c | 8 ++++++-- > kernel/sched/rt.c | 4 ++++ > 5 files changed, 38 insertions(+), 6 deletions(-) > > diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h > index d1ad3d825561..6f6641e61236 100644 > --- a/include/linux/sched/cpufreq.h > +++ b/include/linux/sched/cpufreq.h > @@ -8,10 +8,15 @@ > * Interface between cpufreq drivers and the scheduler: > */ > > +#define SCHED_CPUFREQ_CLEAR (1U << 31) I'm not thrilled by this, because schedutil is not the only user of the flags and it's totally unclear what the other user(s) should do when this is set. Thanks, Rafael