linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Oscar Salvador <osalvador@suse.de>, Zi Yan <ziy@nvidia.com>
Cc: linux-mm@kvack.org, Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v2] mm: remove migration for HugePage in isolate_single_pageblock()
Date: Tue, 20 Aug 2024 16:01:43 +0200	[thread overview]
Message-ID: <1348c6a5-f23c-4a25-921b-67262f0d919e@redhat.com> (raw)
In-Reply-To: <5bf9cf7f-1c1b-42ec-be31-24b34024d599@huawei.com>

On 20.08.24 16:00, Kefeng Wang wrote:
> 
> 
> On 2024/8/20 16:42, David Hildenbrand wrote:
>> On 20.08.24 05:26, Kefeng Wang wrote:
>>> The gigantic page size may larger than memory block size, so memory
>>> offline always fails in this case after commit b2c9e2fbba32 ("mm: make
>>> alloc_contig_range work at pageblock granularity"),
>>>
>>> offline_pages
>>>     start_isolate_page_range
>>>       start_isolate_page_range(isolate_before=true)
>>>         isolate [isolate_start, isolate_start + pageblock_nr_pages)
>>>       start_isolate_page_range(isolate_before=false)
>>>         isolate [isolate_end - pageblock_nr_pages, isolate_end) pageblock
>>>              __alloc_contig_migrate_range
>>>             isolate_migratepages_range
>>>               isolate_migratepages_block
>>>                 isolate_or_dissolve_huge_page
>>>                   if (hstate_is_gigantic(h))
>>>                       return -ENOMEM;
>>>
>>> [   15.815756] memory offlining [mem 0x3c0000000-0x3c7ffffff] failed
>>> due to failure to isolate range
>>>
>>> Gigantic PageHuge is bigger than a pageblock, but since it is freed as
>>> order-0 pages, its pageblocks after being freed will get to the right
>>> free list. There is no need to have special handling code for them in
>>> start_isolate_page_range(). For both alloc_contig_range() and memory
>>> offline cases, the migration code after start_isolate_page_range() will
>>> be able to migrate gigantic PageHuge when possible.
>>>
>>> Let's clean up start_isolate_page_range() and fix the aforementioned
>>> memory offline failure issue all together.
>>>
>>> Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock
>>> granularity")
>>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>>> ---
> ...
> 
>>> +            if (head_pfn + nr_pages <= boundary_pfn ||
>>> +                PageHuge(page)) {
>>
>> I'm wondering if we should have here some kind of WARN_ON_ONCE if
>> PageLRU + "spans more than a single pageblock" check.
>>
>> Then we could catch whenever we would have !hugetlb LRU folios that span
>> more than a single pageblock.
>>
>> /*
>>    * We cannot currently handle movable (LRU) folios that span more than
>>    * a single pageblock. hugetlb folios are fine, though.
>>    */
>> WARN_ON_ONCE(PageLRU(page) && nr_pages > pageblock_nr_pages
> 
> This should be already covered by following VM_WRAN,
> 
>    VM_WARN_ON_ONCE_PAGE(PageLRU(page), page); // only hint when head_pfn
> + nr_pages > boundary_pfn ( boundary_pfn is pageblock aligned)

Ahh, good!

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-08-20 14:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  3:26 Kefeng Wang
2024-08-20  8:42 ` David Hildenbrand
2024-08-20 14:00   ` Kefeng Wang
2024-08-20 14:01     ` David Hildenbrand [this message]
2024-08-20 12:23 ` Zi Yan

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=1348c6a5-f23c-4a25-921b-67262f0d919e@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.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