[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <007046e9-4655-42d1-0422-6a210f726eff@redhat.com>
Date: Thu, 11 Feb 2021 11:40:13 +0100
From: David Hildenbrand <david@...hat.com>
To: Mike Kravetz <mike.kravetz@...cle.com>,
Oscar Salvador <osalvador@...e.de>
Cc: Muchun Song <songmuchun@...edance.com>,
Michal Hocko <mhocko@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/2] mm,page_alloc: Make alloc_contig_range handle
in-use hugetlb pages
On 11.02.21 01:56, Mike Kravetz wrote:
> On 2/8/21 2:38 AM, Oscar Salvador wrote:
>> alloc_contig_range is not prepared to handle hugetlb pages and will
>> fail if it ever sees one, but since they can be migrated as any other
>> page (LRU and Movable), it makes sense to also handle them.
>>
>> For now, do it only when coming from alloc_contig_range.
>>
>> Signed-off-by: Oscar Salvador <osalvador@...e.de>
>> ---
>> mm/compaction.c | 17 +++++++++++++++++
>> mm/vmscan.c | 5 +++--
>> 2 files changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/compaction.c b/mm/compaction.c
>> index e5acb9714436..89cd2e60da29 100644
>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -940,6 +940,22 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>> goto isolate_fail;
>> }
>>
>> + /*
>> + * Handle hugetlb pages only when coming from alloc_contig
>> + */
>> + if (PageHuge(page) && cc->alloc_contig) {
>> + if (page_count(page)) {
>
> Thanks for doing this!
>
> I agree with everything in the discussion you and David had. This code
> is racy, but since we are scanning lockless there is no way to eliminate
> them all. Best to just minimize the windows and document.
>
Agreed - and make sure that we don't have strange side. (e.g., in the
next patch, allocate a new page, try to dissolve. Dissolving fails, what
happens to the just-allocated page?)
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists