[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce96a71d-845b-b8d2-92d3-fc7336a765c5@oracle.com>
Date: Wed, 3 Feb 2021 15:32:22 +0000
From: Joao Martins <joao.m.martins@...cle.com>
To: Pavel Tatashin <pasha.tatashin@...een.com>
Cc: Jason Gunthorpe <jgg@...pe.ca>,
LKML <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Michal Hocko <mhocko@...e.com>,
David Hildenbrand <david@...hat.com>,
Oscar Salvador <osalvador@...e.de>,
Dan Williams <dan.j.williams@...el.com>,
Sasha Levin <sashal@...nel.org>,
Tyler Hicks <tyhicks@...ux.microsoft.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Mel Gorman <mgorman@...e.de>,
Matthew Wilcox <willy@...radead.org>,
David Rientjes <rientjes@...gle.com>,
John Hubbard <jhubbard@...dia.com>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
Ira Weiny <ira.weiny@...el.com>,
linux-kselftest@...r.kernel.org, James Morris <jmorris@...ei.org>
Subject: Re: [PATCH v8 02/14] mm/gup: check every subpage of a compound page
during isolation
On 2/3/21 2:51 PM, Pavel Tatashin wrote:
> On Wed, Feb 3, 2021 at 8:23 AM Joao Martins <joao.m.martins@...cle.com> wrote:
>>
>> On 1/25/21 7:47 PM, Pavel Tatashin wrote:
>>> When pages are isolated in check_and_migrate_movable_pages() we skip
>>> compound number of pages at a time. However, as Jason noted, it is
>>> not necessary correct that pages[i] corresponds to the pages that
>>> we skipped. This is because it is possible that the addresses in
>>> this range had split_huge_pmd()/split_huge_pud(), and these functions
>>> do not update the compound page metadata.
>>>
>>> The problem can be reproduced if something like this occurs:
>>>
>>> 1. User faulted huge pages.
>>> 2. split_huge_pmd() was called for some reason
>>> 3. User has unmapped some sub-pages in the range
>>> 4. User tries to longterm pin the addresses.
>>>
>>> The resulting pages[i] might end-up having pages which are not compound
>>> size page aligned.
>>>
>>> Fixes: aa712399c1e8 ("mm/gup: speed up check_and_migrate_cma_pages() on huge page")
>>> Reported-by: Jason Gunthorpe <jgg@...dia.com>
>>> Signed-off-by: Pavel Tatashin <pasha.tatashin@...een.com>
>>> Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
>>> ---
>>
>> [...]
>>
>>> /*
>>> * If we get a page from the CMA zone, since we are going to
>>> * be pinning these entries, we might as well move them out
>>> @@ -1599,8 +1596,6 @@ static long check_and_migrate_cma_pages(struct mm_struct *mm,
>>> }
>>> }
>>> }
>>> -
>>> - i += step;
>>> }
>>>
>>
>
> Hi Joao,
>
>> With this, longterm gup will 'regress' for hugetlbfs e.g. from ~6k -> ~32k usecs when
>> pinning a 16G hugetlb file.
>
> Estimate or you actually measured?
>
It's what I had measured before sending. The ~ is because there's error variance.
>>
>
>> Splitting can only occur on THP right? If so, perhaps we could retain the @step increment
>
> Yes, I do not think we can split HugePage, only THP.
>
Right, that's my impression too.
>> for compound pages but when !is_transparent_hugepage(head) or just PageHuge(head) like:
>>
>> + if (!is_transparent_hugepage(head) && PageCompound(page))
>> + i += (compound_nr(head) - (pages[i] - head));
>>
>> Or making specific to hugetlbfs:
>>
>> + if (PageHuge(head))
>> + i += (compound_nr(head) - (pages[i] - head));
>
> Yes, this is reasonable optimization. I will submit a follow up patch
> against linux-next.
Powered by blists - more mailing lists