[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7d06f91-1552-9afa-a0ae-396bc9c703d5@intel.com>
Date: Fri, 14 Jul 2023 10:49:32 +0800
From: "Yin, Fengwei" <fengwei.yin@...el.com>
To: Hugh Dickins <hughd@...gle.com>
CC: Yu Zhao <yuzhao@...gle.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <akpm@...ux-foundation.org>,
<willy@...radead.org>, <david@...hat.com>, <ryan.roberts@....com>,
<shy828301@...il.com>
Subject: Re: [RFC PATCH v2 2/3] mm: handle large folio when large folio in
VM_LOCKED VMA range
On 7/14/2023 10:21 AM, Hugh Dickins wrote:
> On Wed, 12 Jul 2023, Yin Fengwei wrote:
>> On 7/12/23 14:23, Yu Zhao wrote:
>>> On Wed, Jul 12, 2023 at 12:02 AM Yin Fengwei <fengwei.yin@...el.com> wrote:
>>>> --- a/
>>>> +++ b/mm/internal.h
>>>> @@ -643,7 +643,8 @@ static inline void mlock_vma_folio(struct folio *folio,
>>>> * still be set while VM_SPECIAL bits are added: so ignore it then.
>>>> */
>>>> if (unlikely((vma->vm_flags & (VM_LOCKED|VM_SPECIAL)) == VM_LOCKED) &&
>>>> - (compound || !folio_test_large(folio)))
>>>> + (compound || !folio_test_large(folio) ||
>>>> + folio_in_range(folio, vma, vma->vm_start, vma->vm_end)))
>>>> mlock_folio(folio);
>>>> }
>>>
>>> This can be simplified:
>>> 1. remove the compound parameter
>> Yes. There is not difference here for pmd mapping of THPs and pte mappings of THPs
>> if the only condition need check is whether the folio is within VMA range or not.
>>
>> But let me add Huge for confirmation.
>
> I'm not sure what it is that you need me to confirm: if the folio fits
> within the vma, then the folio fits within the vma, pmd-mapped or not.
Sorry. My bad. I should speak it out for what I want your confirmation:
Whether we can remove the compound and use whether folio is within
VMA instead.
I suppose you answer is Yes.
>
> (And I agree with Yu that it's better to drop the folio_test_large()
> check too.)
My argument was folio_test_large() can filter the normal 4K page out so
it doesn't need to call folio_in_range() which looks to me a little bit
heavy for normal 4K page. And the deal was move folio_test_large()
to folio_in_range() like function so simplify the code in caller side.
>
> This idea, of counting the folio as mlocked according to whether the
> whole folio fits within the vma, does seem a good idea to me: worth
> pursuing. But whether the implementation adds up and works out, I
> have not checked. It was always difficult to arrive at a satisfactory
> compromise in mlocking compound pages: I hope this way does work out.
This is the purpose of this patch. :). Thanks.
Regards
Yin, Fengwei
>
> Hugh
Powered by blists - more mailing lists