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]
Date:   Wed, 28 Oct 2020 03:06:49 +0800
From:   Hui Su <sh_def@....com>
To:     Vlastimil Babka <vbabka@...e.cz>
Cc:     akpm@...ux-foundation.org, gustavo@...eddedor.com,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] mm/list_lru: optimize condition of exiting the loop

On Tue, Oct 27, 2020 at 07:45:53PM +0100, Vlastimil Babka wrote:
> On 10/27/20 6:04 PM, Hui Su wrote:
> > In list_lru_walk(), nr_to_walk type is 'unsigned long',
> > so nr_to_walk won't be '< 0'.
> > 
> > In list_lru_walk_node(), nr_to_walk type is 'unsigned long',
> > so *nr_to_walk won't be '< 0' too.
> > 
> > We can use '!nr_to_walk' instead of 'nr_to_walk <= 0', which
> > is more precise.
> > 
> > Signed-off-by: Hui Su <sh_def@....com>
> 
> OK. Why not this too?
> 
> --- a/mm/list_lru.c
> +++ b/mm/list_lru.c
> @@ -294,7 +294,7 @@ unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
> 
>         isolated += list_lru_walk_one(lru, nid, NULL, isolate, cb_arg,
>                                       nr_to_walk);
> -       if (*nr_to_walk > 0 && list_lru_memcg_aware(lru)) {
> +       if (*nr_to_walk && list_lru_memcg_aware(lru)) {
>                 for_each_memcg_cache_index(memcg_idx) {
>                         struct list_lru_node *nlru = &lru->node[nid];
> 
> 

Thanks for your fast reply.

I did not notice that, and i would add this to my change.
I will resend PATCH V2, and cc to you.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ