lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtBvJha6Lt3411awLv9DukBWgObt8=4WtMM0c-Fusx2=-Q@mail.gmail.com>
Date:   Tue, 23 Aug 2022 09:49:44 +0200
From:   Vincent Guittot <vincent.guittot@...aro.org>
To:     Chengming Zhou <zhouchengming@...edance.com>
Cc:     dietmar.eggemann@....com, mingo@...hat.com, peterz@...radead.org,
        rostedt@...dmis.org, bsegall@...gle.com, vschneid@...hat.com,
        linux-kernel@...r.kernel.org, tj@...nel.org
Subject: Re: [PATCH v6 9/9] sched/fair: don't init util/runnable_avg for !fair task

On Thu, 18 Aug 2022 at 14:48, Chengming Zhou
<zhouchengming@...edance.com> wrote:
>
> post_init_entity_util_avg() init task util_avg according to the cpu util_avg
> at the time of fork, which will decay when switched_to_fair() some time later,
> we'd better to not set them at all in the case of !fair task.
>
> Suggested-by: Vincent Guittot <vincent.guittot@...aro.org>
> Signed-off-by: Chengming Zhou <zhouchengming@...edance.com>

Reviewed-by: Vincent Guittot <vincent.guittot@...aro.org>

> ---
>  kernel/sched/fair.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 93d7c7b110dd..621bd19e10ae 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -833,20 +833,6 @@ void post_init_entity_util_avg(struct task_struct *p)
>         long cpu_scale = arch_scale_cpu_capacity(cpu_of(rq_of(cfs_rq)));
>         long cap = (long)(cpu_scale - cfs_rq->avg.util_avg) / 2;
>
> -       if (cap > 0) {
> -               if (cfs_rq->avg.util_avg != 0) {
> -                       sa->util_avg  = cfs_rq->avg.util_avg * se->load.weight;
> -                       sa->util_avg /= (cfs_rq->avg.load_avg + 1);
> -
> -                       if (sa->util_avg > cap)
> -                               sa->util_avg = cap;
> -               } else {
> -                       sa->util_avg = cap;
> -               }
> -       }
> -
> -       sa->runnable_avg = sa->util_avg;
> -
>         if (p->sched_class != &fair_sched_class) {
>                 /*
>                  * For !fair tasks do:
> @@ -861,6 +847,20 @@ void post_init_entity_util_avg(struct task_struct *p)
>                 se->avg.last_update_time = cfs_rq_clock_pelt(cfs_rq);
>                 return;
>         }
> +
> +       if (cap > 0) {
> +               if (cfs_rq->avg.util_avg != 0) {
> +                       sa->util_avg  = cfs_rq->avg.util_avg * se->load.weight;
> +                       sa->util_avg /= (cfs_rq->avg.load_avg + 1);
> +
> +                       if (sa->util_avg > cap)
> +                               sa->util_avg = cap;
> +               } else {
> +                       sa->util_avg = cap;
> +               }
> +       }
> +
> +       sa->runnable_avg = sa->util_avg;
>  }
>
>  #else /* !CONFIG_SMP */
> --
> 2.37.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ