From: Zi Yan <ziy@nvidia.com>
To: David Hildenbrand <david@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Oscar Salvador <osalvador@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Mel Gorman <mgorman@techsingularity.net>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <jackmanb@google.com>,
Richard Chang <richardycc@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 0/4] Make MIGRATE_ISOLATE a standalone bit
Date: Tue, 20 May 2025 09:18:40 -0400 [thread overview]
Message-ID: <EDDFDB5C-2C2E-49E8-95CA-A1663C33EA7A@nvidia.com> (raw)
In-Reply-To: <43ab8a08-b577-4e6d-8920-1761ffbc01fc@redhat.com>
On 20 May 2025, at 4:58, David Hildenbrand wrote:
> On 19.05.25 16:35, Zi Yan wrote:
>> On 19 May 2025, at 10:15, David Hildenbrand wrote:
>>
>>> On 18.05.25 02:20, Zi Yan wrote:
>>>> On 17 May 2025, at 16:26, Vlastimil Babka wrote:
>>>>
>>>>> On 5/9/25 22:01, Zi Yan wrote:
>>>>>> Hi David and Oscar,
>>>>>>
>>>>>> Can you take a look at Patch 2, which changes how online_pages() set
>>>>>> online pageblock migratetypes? It used to first set all pageblocks to
>>>>>> MIGRATE_ISOLATE, then let undo_isolate_page_range() move the pageblocks
>>>>>> to MIGRATE_MOVABLE. After MIGRATE_ISOLATE becomes a standalone bit, all
>>>>>> online pageblocks need to have a migratetype other than MIGRATE_ISOLATE.
>>>>>> Let me know if there is any issue with my changes.
>>>>>>
>>>>>> Hi Johannes,
>>>>>>
>>>>>> Patch 2 now have set_pageblock_migratetype() not accepting
>>>>>> MIGRATE_ISOLATE. I think it makes code better. Thank you for the great
>>>>>> feedback.
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> This patchset moves MIGRATE_ISOLATE to a standalone bit to avoid
>>>>>> being overwritten during pageblock isolation process. Currently,
>>>>>> MIGRATE_ISOLATE is part of enum migratetype (in include/linux/mmzone.h),
>>>>>> thus, setting a pageblock to MIGRATE_ISOLATE overwrites its original
>>>>>> migratetype. This causes pageblock migratetype loss during
>>>>>> alloc_contig_range() and memory offline, especially when the process
>>>>>> fails due to a failed pageblock isolation and the code tries to undo the
>>>>>> finished pageblock isolations.
>>>>>
>>>>> Seems mostly fine to me, just sent suggestion for 4/4.
>>>>
>>>> Thanks.
>>>>
>>>>> I was kinda hoping that MIGRATE_ISOLATE could stop being a migratetype. But
>>>>> I also see that it's useful for it to be because then it means it has the
>>>>> freelists in the buddy allocator, can work via __move_freepages_block() etc.
>>>>
>>>> Yeah, I wanted to remove MIGRATE_ISOLATE from migratetype too, but there
>>>> is a MIGRATE_ISOLATE freelist and /proc/pagetypeinfo also shows isolated
>>>> free pages.
>>>
>>> The latter, we can likely fake.
>>>
>>> Is there a reasonable way to remove MIGRATE_ISOLATE completely?
>>>
>>> Of course, we could simply duplicate the page lists (one set for isolated, one set for !isolated), or keep it as is and simply have a
>>
>> That could work. It will change vmcore layout and I wonder if that is a concern
>> or not.
>
> Not really. makedumpfile will have to implement support for the new layout as it adds support for the new kernel version.
Got it.
>
>>
>>> separate one that we separate out. So, we could have a migratetype+isolated pair instead.
>>
>> What do you mean by a migratetype+isolate pair?
>
> If MIGRATE_ISOLATE no longer exists, relevant code would have to pass migratetype+isolated (essentially, what you did in init_pageblock_migratetype ).
>
>
> E.g., we could pass around a "pageblock_info" (or however we call it, using a different type than a bare migratetype) from which we can easily extract the migratetype and the isolated state.
>
>
> E.g., init_pageblock_migratetype() could then become
>
> struct pageblock_info pb_info = {
> .migratetype = MIGRATE_MOVABLE,
> .isolated = true,
> }
> init_pageblock_info(page, pb_info);
>
> So, we'd decouple the migratetype we pass around from the "isolated" state. Whoever needs the "isolated" state in addition to the migratetype should use get_pageblock_info().
>
> When adding to lists, we can decide what to do based on that information.
This looks good to me. I can send a follow-up patchset to get rid of
MIGRATE_ISOLATE along with more cleanups like changing "int migratetype" to
"enum migratetype migratetype" in mm/page_alloc.c.
>
>>
>>>
>>> Just a thought, did not look into all the ugly details.
>>
>> Another thought is that maybe caller should keep the isolated free pages instead
>> to make it actually isolated.
>
> You mean, not adding them to a list at all in the buddy? I think the problem is that
Yes.
> if a page gets freed while the pageblock is isolated, it cannot get added to the list of an owner easily.
Right. In theory, it is possible, since when a MIGRATED_ISOLATE page is freed,
__free_one_page() can find its buddy and add the freed page to its buddy's
buddy_list without performing a merge like current code. But it needs a new
code path in __add_to_free_list(), since it is not added to the head nor the
tail of a free list.
--
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2025-05-20 13:18 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 20:01 Zi Yan
2025-05-09 20:01 ` [PATCH v4 1/4] mm/page_isolation: make page isolation " Zi Yan
2025-05-13 11:32 ` Brendan Jackman
2025-05-13 14:53 ` Zi Yan
2025-05-19 8:08 ` David Hildenbrand
2025-05-19 15:08 ` Zi Yan
2025-05-19 16:42 ` David Hildenbrand
2025-05-19 17:15 ` Zi Yan
2025-05-21 11:16 ` Zi Yan
2025-05-21 11:57 ` David Hildenbrand
2025-05-21 12:00 ` Zi Yan
2025-05-21 12:11 ` David Hildenbrand
2025-05-21 12:18 ` Zi Yan
2025-05-09 20:01 ` [PATCH v4 2/4] mm/page_isolation: remove migratetype from move_freepages_block_isolate() Zi Yan
2025-05-12 6:25 ` kernel test robot
2025-05-12 16:10 ` Lorenzo Stoakes
2025-05-12 16:13 ` Zi Yan
2025-05-12 16:19 ` Lorenzo Stoakes
2025-05-12 16:28 ` Zi Yan
2025-05-12 22:00 ` Andrew Morton
2025-05-12 23:20 ` Zi Yan
2025-05-19 8:21 ` David Hildenbrand
2025-05-19 23:06 ` Zi Yan
2025-05-20 8:58 ` David Hildenbrand
2025-05-09 20:01 ` [PATCH v4 3/4] mm/page_isolation: remove migratetype from undo_isolate_page_range() Zi Yan
2025-05-09 20:01 ` [PATCH v4 4/4] mm/page_isolation: remove migratetype parameter from more functions Zi Yan
2025-05-17 20:21 ` Vlastimil Babka
2025-05-18 0:07 ` Zi Yan
2025-05-18 16:32 ` Johannes Weiner
2025-05-18 17:24 ` Zi Yan
2025-05-17 20:26 ` [PATCH v4 0/4] Make MIGRATE_ISOLATE a standalone bit Vlastimil Babka
2025-05-18 0:20 ` Zi Yan
2025-05-19 14:15 ` David Hildenbrand
2025-05-19 14:35 ` Zi Yan
2025-05-20 8:58 ` David Hildenbrand
2025-05-20 13:18 ` Zi Yan [this message]
2025-05-20 13:20 ` David Hildenbrand
2025-05-20 13:31 ` Zi Yan
2025-05-20 13:33 ` David Hildenbrand
2025-05-20 14:07 ` Zi Yan
2025-05-19 7:44 ` David Hildenbrand
2025-05-19 14:01 ` 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=EDDFDB5C-2C2E-49E8-95CA-A1663C33EA7A@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=jackmanb@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=richardycc@google.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
/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