From: Wei Yang <richardw.yang@linux.intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Wei Yang <richardw.yang@linux.intel.com>,
Wei Yang <richard.weiyang@gmail.com>,
"Kirill A. Shutemov" <kirill@shutemov.name>,
akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm/page_vma_mapped: page table boundary is already guaranteed
Date: Mon, 2 Dec 2019 14:53:47 +0800 [thread overview]
Message-ID: <20191202065347.GA22786@richard> (raw)
In-Reply-To: <20191129111801.GH20752@bombadil.infradead.org>
On Fri, Nov 29, 2019 at 03:18:01AM -0800, Matthew Wilcox wrote:
>On Fri, Nov 29, 2019 at 04:30:02PM +0800, Wei Yang wrote:
>> On Thu, Nov 28, 2019 at 02:39:04PM -0800, Matthew Wilcox wrote:
>> >On Thu, Nov 28, 2019 at 09:09:45PM +0000, Wei Yang wrote:
>> >> On Thu, Nov 28, 2019 at 11:31:43AM +0300, Kirill A. Shutemov wrote:
>> >> >On Thu, Nov 28, 2019 at 09:03:21AM +0800, Wei Yang wrote:
>> >> >> The check here is to guarantee pvmw->address iteration is limited in one
>> >> >> page table boundary. To be specific, here the address range should be in
>> >> >> one PMD_SIZE.
>> >> >>
>> >> >> If my understanding is correct, this check is already done in the above
>> >> >> check:
>> >> >>
>> >> >> address >= __vma_address(page, vma) + PMD_SIZE
>> >> >>
>> >> >> The boundary check here seems not necessary.
>> >> >>
>> >> >> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> >> >
>> >> >NAK.
>> >> >
>> >> >THP can be mapped with PTE not aligned to PMD_SIZE. Consider mremap().
>> >> >
>> >>
>> >> Hi, Kirill
>> >>
>> >> Thanks for your comment during Thanks Giving Day. Happy holiday:-)
>> >>
>> >> I didn't think about this case before, thanks for reminding. Then I tried to
>> >> understand your concern.
>> >>
>> >> mremap() would expand/shrink a memory mapping. In this case, probably shrink
>> >> is in concern. Since pvmw->page and pvmw->vma are not changed in the loop, the
>> >> case you mentioned maybe pvmw->page is the head of a THP but part of it is
>> >> unmapped.
>> >
>> >mremap() can also move a mapping, see MREMAP_FIXED.
>>
>> Hi, Matthew
>>
>> Thanks for your comment.
>>
>> I took a look into the MREMAP_FIXED case, but still not clear in which case it
>> fall into the situation Kirill mentioned.
>>
>> Per my understanding, move mapping is achieved in two steps:
>>
>> * unmap some range in old vma if old_len >= new_len
>> * move vma
>>
>> If the length doesn't change, we are expecting to have the "copy" of old
>> vma. This doesn't change the THP PMD mapping.
>>
>> So the change still happens in the unmap step, if I am correct.
>>
>> Would you mind giving me more hint on the case when we would have the
>> situation as Kirill mentioned?
>
>Set up a THP mapping.
>Move it to an address which is no longer 2MB aligned.
>Unmap it.
Thanks Matthew
I got the point, thanks a lot :-)
--
Wei Yang
Help you, Help me
next prev parent reply other threads:[~2019-12-02 6:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 1:03 [PATCH 1/2] mm/page_vma_mapped: use PMD_SIZE instead of calculating it Wei Yang
2019-11-28 1:03 ` [PATCH 2/2] mm/page_vma_mapped: page table boundary is already guaranteed Wei Yang
2019-11-28 8:31 ` Kirill A. Shutemov
2019-11-28 21:09 ` Wei Yang
2019-11-28 22:39 ` Matthew Wilcox
2019-11-29 8:30 ` Wei Yang
2019-11-29 11:18 ` Matthew Wilcox
2019-12-02 6:53 ` Wei Yang [this message]
2019-11-28 8:32 ` [PATCH 1/2] mm/page_vma_mapped: use PMD_SIZE instead of calculating it Kirill A. Shutemov
2019-11-28 21:22 ` Wei Yang
2019-12-02 8:03 ` Kirill A. Shutemov
2019-12-02 8:54 ` Wei Yang
2019-12-02 22:21 ` Wei Yang
2019-12-03 9:47 ` Kirill A. Shutemov
2019-12-03 15:14 ` 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=20191202065347.GA22786@richard \
--to=richardw.yang@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=richard.weiyang@gmail.com \
--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 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).