From: Wei Yang <richard.weiyang@gmail.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Wei Yang <richardw.yang@linux.intel.com>,
Michal Hocko <mhocko@kernel.org>,
akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmap.c: refine data locality of find_vma_prev
Date: Thu, 8 Aug 2019 14:33:36 +0000 [thread overview]
Message-ID: <20190808143336.kgq4f6j5gfixtcb4@master> (raw)
In-Reply-To: <d4aab7f0-b653-8636-b5a7-97d3291f289d@suse.cz>
On Thu, Aug 08, 2019 at 10:49:29AM +0200, Vlastimil Babka wrote:
>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.
>
Thanks, I would send this version with proper change log.
>>> --
>>> Michal Hocko
>>> SUSE Labs
>>
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2019-08-08 14:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 8:11 [PATCH] mm/mmap.c: refine data locality of find_vma_prev Wei Yang
2019-08-06 9:29 ` Vlastimil Babka
2019-08-07 0:31 ` Wei Yang
2019-08-07 7:51 ` Michal Hocko
2019-08-08 3:26 ` Wei Yang
2019-08-08 6:02 ` Michal Hocko
2019-08-08 8:44 ` Wei Yang
2019-08-08 8:49 ` Vlastimil Babka
2019-08-08 14:33 ` Wei Yang [this message]
2019-08-06 10:58 ` Balbir Singh
2019-08-07 0:32 ` Wei Yang
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=20190808143336.kgq4f6j5gfixtcb4@master \
--to=richard.weiyang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=richardw.yang@linux.intel.com \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).