From: Li Xinhai <lixinhai.lxh@gmail.com>
To: Mike Kravetz <mike.kravetz@oracle.com>, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH] mm/hugetlb.c: fix unnecessary address expansion of pmd sharing
Date: Tue, 5 Jan 2021 10:38:22 +0800 [thread overview]
Message-ID: <76585d60-f4d7-646e-6e45-2d68368561c4@gmail.com> (raw)
In-Reply-To: <ceab9c6e-7159-c364-8f88-733793de96d7@gmail.com>
On 1/5/21 10:10 AM, Li Xinhai wrote:
>
>
> On 1/5/21 2:59 AM, Mike Kravetz wrote:
>> On 1/3/21 11:10 PM, Li Xinhai wrote:
>>>
>>>
>>> On 1/4/21 11:55 AM, Mike Kravetz wrote:
>>>> I believe the only case where your patch produced incorrect results is
>>>> when the range was within a vma that was smaller than PUD_SIZE. Do you
>>>> agree?
>>>>
>>> Not exactly. We need to consider for vma which span at least one
>>> PUD_SIZE after align its vm_start and vm_end.
>>>
>>
>> I know that I provided an incorrect example again. Sorry (again)!
>>
>> Can you provide an example where adding the simple check for vma size
>> less
>> than PUD_SIZE to your original patch will not work. The logic in your V2
>> patch is correct. However, I am having a hard time finding a problem
>> with
>> this simpler approach.
>>
>
>
> Thanks for checking. An example like this:
> (vm_start, vm_end) = (2G - 6M, 2G+8M), so this vma is bigger than
> PUD_SIZE, and the check for vma size bigger than PUD_SIZE will pass.
>
> With (start, end) = (2G-4M, 2G-2M), the previous patch will not adjust
> start(because adjust it from (2G-4M) to 1G will exceeding vm_start), but
> it will adjust end from (2G-2M) to 2G (because 2G still below vm_end).
>
> The adjustment of end is incorrect, because (2G-6M, 2G) range of vma
> is not allowed for PMD sharing(i.e., that range do not fully occupy
> PUD_SIZE). If we make the wrong adjustment, then we will unnecessarily
> impact to range (2G-2M, 2G).
>
>
sorry, the above example is not correct for vma size, update it as
below:
(vm_start, vm_end) = (2G - 600M, 2G+800M), so this vma is bigger than
PUD_SIZE, and the check for vma size bigger than PUD_SIZE will pass.
With (start, end) = (2G-4M, 2G-2M), the previous patch will not adjust
start(because adjust it from (2G-4M) to 1G will exceeding vm_start), but
it will adjust end from (2G-2M) to 2G (because 2G still below vm_end).
The adjustment of end is incorrect, because (2G-600M, 2G) range of vma
is not allowed for PMD sharing(i.e., that range do not fully occupy
PUD_SIZE). If we make the wrong adjustment, then we will unnecessarily
impact to range (2G-2M, 2G).
next prev parent reply other threads:[~2021-01-05 2:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 4:21 Li Xinhai
2020-12-29 19:21 ` Andrew Morton
2020-12-29 21:20 ` Mike Kravetz
2020-12-31 17:56 ` Mike Kravetz
2021-01-02 11:56 ` Li Xinhai
2021-01-04 3:55 ` Mike Kravetz
2021-01-04 7:10 ` Li Xinhai
2021-01-04 18:59 ` Mike Kravetz
2021-01-05 2:10 ` Li Xinhai
2021-01-05 2:38 ` Li Xinhai [this message]
2021-01-05 18:20 ` Mike Kravetz
2020-12-30 18:42 ` Peter Xu
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=76585d60-f4d7-646e-6e45-2d68368561c4@gmail.com \
--to=lixinhai.lxh@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=peterx@redhat.com \
/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