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] [day] [month] [year] [list]
Message-ID: <CAKfTPtDWVoSsXL6Zh6ZNW7eeHsoZxVBHa2fkY7rNm1mA-tbyXg@mail.gmail.com>
Date:   Thu, 7 Jan 2021 09:27:04 +0100
From:   Vincent Guittot <vincent.guittot@...aro.org>
To:     qianjun.kernel@...il.com
Cc:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] sched/fair:Avoid unnecessary assignment to cfs_rq->on_list

On Thu, 7 Jan 2021 at 02:57, <qianjun.kernel@...il.com> wrote:
>
> From: jun qian <qianjun.kernel@...il.com>
>
> Obviously, cfs_rq->on_list is already equal to 1 when cfs_rq->on_list
> is assigned a value of 1, so an else branch is needed to avoid unnecessary
> assignment operations.
>
> Signed-off-by: jun qian <qianjun.kernel@...il.com>
> ---
>  kernel/sched/fair.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 04a3ce20da67..ef6ebd95443d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -305,8 +305,8 @@ static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
>
>         if (cfs_rq->on_list)
>                 return rq->tmp_alone_branch == &rq->leaf_cfs_rq_list;

if cfs_rq->on_list == 1, list_add_leaf_cfs_rq() returns and will not
unnecessary set cfs_rq->on_list

so your change is useless but makes the code less readable

> -
> -       cfs_rq->on_list = 1;
> +       else
> +               cfs_rq->on_list = 1;
>
>         /*
>          * Ensure we either appear before our parent (if already
> --
> 2.18.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ