From: Wei Yang <richardw.yang@linux.intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Wei Yang <richardw.yang@linux.intel.com>,
akpm@linux-foundation.org, mgorman@techsingularity.net,
vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mmap.c: rb_parent is not necessary in __vma_link_list
Date: Tue, 13 Aug 2019 13:25:34 +0800 [thread overview]
Message-ID: <20190813052534.GA17131@richard> (raw)
In-Reply-To: <20190813033958.GB5307@bombadil.infradead.org>
On Mon, Aug 12, 2019 at 08:39:58PM -0700, Matthew Wilcox wrote:
>On Tue, Aug 13, 2019 at 11:26:56AM +0800, Wei Yang wrote:
>> Now we use rb_parent to get next, while this is not necessary.
>>
>> When prev is NULL, this means vma should be the first element in the
>> list. Then next should be current first one (mm->mmap), no matter
>> whether we have parent or not.
>>
>> After removing it, the code shows the beauty of symmetry.
>
>Uhh ... did you test this?
>
I reboot successfully with this patch.
>> @@ -273,12 +273,8 @@ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma,
>> next = prev->vm_next;
>> prev->vm_next = vma;
>> } else {
>> + next = mm->mmap;
>> mm->mmap = vma;
>> - if (rb_parent)
>> - next = rb_entry(rb_parent,
>> - struct vm_area_struct, vm_rb);
>> - else
>> - next = NULL;
>> }
>
>The full context is:
>
> if (prev) {
> next = prev->vm_next;
> prev->vm_next = vma;
> } else {
> mm->mmap = vma;
> if (rb_parent)
> next = rb_entry(rb_parent,
> struct vm_area_struct, vm_rb);
> else
> next = NULL;
> }
>
>Let's imagine we have a small tree with three ranges in it.
>
>A: 5-7
>B: 8-10
>C: 11-13
>
>I would imagine an rbtree for this case has B at the top with A
>to its left and B to its right.
>
>Now we're going to add range D at 3-4. 'next' should clearly be range A.
>It will have NULL prev. Your code is going to make 'B' next, not A.
>Right?
mm->mmap is not the rb_root.
mm->mmap is the first element in the ordered list, if my understanding is
correct.
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2019-08-13 5:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-13 3:26 [PATCH] mm/mmap.c: rb_parent is not necessary in __vma_link_list Wei Yang
2019-08-13 3:39 ` Matthew Wilcox
2019-08-13 5:25 ` Wei Yang [this message]
2019-08-14 2:19 ` Wei Yang
2019-09-12 3:10 ` 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=20190813052534.GA17131@richard \
--to=richardw.yang@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.