mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qais Yousef <qyousef@layalina.io>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	linux-kernel@vger.kernel.org, Lukasz Luba <lukasz.luba@arm.com>,
	Wei Wang <wvw@google.com>, Xuewen Yan <xuewen.yan94@gmail.com>,
	Hank <han.lin@mediatek.com>,
	Jonathan JMChen <Jonathan.JMChen@mediatek.com>,
	Hongyan Xia <hongyan.xia2@arm.com>
Subject: Re: [PATCH v3 2/3] sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0
Date: Sun, 20 Aug 2023 14:52:31 +0100	[thread overview]
Message-ID: <20230820135231.qcfphadn2kc4nxpa@airbuntu> (raw)
In-Reply-To: <CAKfTPtCAs5_LDkaxVBHW1wHZzpOHvgsL7Tz1PyDDqDHN2UU5Xw@mail.gmail.com>

On 07/21/23 11:57, Vincent Guittot wrote:
> On Mon, 17 Jul 2023 at 23:57, Qais Yousef <qyousef@layalina.io> wrote:
> >
> > find_energy_efficient_cpu() bails out early if effective util of the
> > task is 0 as the delta at this point will be zero and there's nothing
> > for EAS to do. When uclamp is being used, this could lead to wrong
> > decisions when uclamp_max is set to 0. In this case the task is capped
> > to performance point 0, but it is actually running and consuming energy
> > and we can benefit from EAS energy calculations.
> >
> > Rework the condition so that it bails out for when util is actually 0 or
> > uclamp_min is requesting a higher performance point.
> >
> > We can do that without needing to use uclamp_task_util(); remove it.
> >
> > Fixes: d81304bc6193 ("sched/uclamp: Cater for uclamp in find_energy_efficient_cpu()'s early exit condition")
> > Signed-off-by: Qais Yousef (Google) <qyousef@layalina.io>
> 
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>

Thanks Vincent!

Ping in case this has fallen through the cracks. I hope it's good to be picked
up now.


Thanks!

--
Qais Yousef

> 
> > ---
> >  kernel/sched/fair.c | 18 +-----------------
> >  1 file changed, 1 insertion(+), 17 deletions(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index d489eece5a0d..c701f490ca4c 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -4348,22 +4348,6 @@ static inline unsigned long task_util_est(struct task_struct *p)
> >         return max(task_util(p), _task_util_est(p));
> >  }
> >
> > -#ifdef CONFIG_UCLAMP_TASK
> > -static inline unsigned long uclamp_task_util(struct task_struct *p,
> > -                                            unsigned long uclamp_min,
> > -                                            unsigned long uclamp_max)
> > -{
> > -       return clamp(task_util_est(p), uclamp_min, uclamp_max);
> > -}
> > -#else
> > -static inline unsigned long uclamp_task_util(struct task_struct *p,
> > -                                            unsigned long uclamp_min,
> > -                                            unsigned long uclamp_max)
> > -{
> > -       return task_util_est(p);
> > -}
> > -#endif
> > -
> >  static inline void util_est_enqueue(struct cfs_rq *cfs_rq,
> >                                     struct task_struct *p)
> >  {
> > @@ -7588,7 +7572,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
> >         target = prev_cpu;
> >
> >         sync_entity_load_avg(&p->se);
> > -       if (!uclamp_task_util(p, p_util_min, p_util_max))
> > +       if (!task_util_est(p) && p_util_min == 0)
> >                 goto unlock;
> >
> >         eenv_task_busy_time(&eenv, p, prev_cpu);
> > --
> > 2.25.1
> >

  reply	other threads:[~2023-08-20 13:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 21:57 [PATCH v3 0/3] Fix a couple of corner cases in feec() when using uclamp_max Qais Yousef
2023-07-17 21:57 ` [PATCH v3 1/3] sched/uclamp: Set max_spare_cap_cpu even if max_spare_cap is 0 Qais Yousef
2023-07-21  9:56   ` Vincent Guittot
2023-07-17 21:57 ` [PATCH v3 2/3] sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0 Qais Yousef
2023-07-21  9:57   ` Vincent Guittot
2023-08-20 13:52     ` Qais Yousef [this message]
2023-07-17 21:57 ` [PATCH v3 3/3] sched/tp: Add new tracepoint to track compute energy computation Qais Yousef
2023-08-21  9:04   ` Lukasz Luba
2023-08-21 22:36     ` Qais Yousef
2023-08-22  7:43       ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230820135231.qcfphadn2kc4nxpa@airbuntu \
    --to=qyousef@layalina.io \
    --cc=Jonathan.JMChen@mediatek.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=han.lin@mediatek.com \
    --cc=hongyan.xia2@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=wvw@google.com \
    --cc=xuewen.yan94@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®