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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 8 Aug 2019 10:49:29 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Wei Yang <richardw.yang@...ux.intel.com>,
        Michal Hocko <mhocko@...nel.org>
Cc:     akpm@...ux-foundation.org, kirill.shutemov@...ux.intel.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/mmap.c: refine data locality of find_vma_prev

On 8/8/19 5:26 AM, Wei Yang wrote:
> 
> @@ -2270,12 +2270,9 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr,
>         if (vma) {
>                 *pprev = vma->vm_prev;
>         } else {
> -               struct rb_node *rb_node = mm->mm_rb.rb_node;
> -               *pprev = NULL;
> -               while (rb_node) {
> -                       *pprev = rb_entry(rb_node, struct vm_area_struct, vm_rb);
> -                       rb_node = rb_node->rb_right;
> -               }
> +               struct rb_node *rb_node = rb_last(&mm->mm_rb);
> +               *pprev = !rb_node ? NULL :
> +                        rb_entry(rb_node, struct vm_area_struct, vm_rb);
>         }
>         return vma;
> 
> Not sure this style would help a little in understanding the code?

Yeah using rb_last() would be nicer than basically repeating its
implementation, so it's fine as a cleanup without performance implications.

>> -- 
>> Michal Hocko
>> SUSE Labs
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ