From: Zi Yan <ziy@nvidia.com>
To: Brendan Jackman <jackmanb@google.com>
Cc: David Hildenbrand <david@redhat.com>,
Oscar Salvador <osalvador@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
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>,
Richard Chang <richardycc@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/4] mm/page_isolation: make page isolation a standalone bit.
Date: Tue, 13 May 2025 10:53:11 -0400 [thread overview]
Message-ID: <BFE3232B-1BAD-4C21-8C74-3C22CEF7A95F@nvidia.com> (raw)
In-Reply-To: <D9V00HM1BVDZ.106ALY0AVVHFK@google.com>
On 13 May 2025, at 7:32, Brendan Jackman wrote:
> Hi Zi,
>
> I hope you don't mind me jumping in on a late revision like this...
Right on time. :)
>
> On Fri May 9, 2025 at 8:01 PM UTC, Zi Yan wrote:
>> During page isolation, the original migratetype is overwritten, since
>> MIGRATE_* are enums and stored in pageblock bitmaps. Change
>> MIGRATE_ISOLATE to be stored a standalone bit, PB_migrate_isolate, like
>> PB_migrate_skip, so that migratetype is not lost during pageblock
>> isolation. pageblock bits needs to be word aligned, so expand
>> the number of pageblock bits from 4 to 8 and make PB_migrate_isolate bit 7.
>
> Forgive my ignorance but can you help me confirm if I'm following this -
> Do you just mean that NR_PAGEBLOCK_BITS must divide the word size? Or is
> there something else going on here?
You are right. NR_PAGEBLOCK_BITS must divide the word size. I will fix
the commit log in the next version.
>
>> +#ifdef CONFIG_MEMORY_ISOLATION
>> + PB_migrate_isolate = 7, /* If set the block is isolated */
>> + /* set it to 7 to make pageblock bit word aligned */
I will fix this comment too.
>> +#endif
>
> I feel I'm always just asking for commentary so please feel free to
> complain if this is annoying. But I think it would be worth adding the
> context from the commit message into the code here (or somewhere else),
> e.g:
>
> /*
> * Page isolation is represented with a separate bit, so that the other
> * bits can store the migratetype that the block had before it was
> * isolated.
> */
>
> Just adding in that detail about the intent will help readers a lot IMO.
Sure. Will add it.
>
>>
>> +unsigned long get_pageblock_migratetype(const struct page *page)
>> +{
>> + unsigned long flags;
>> +
>> + flags = get_pfnblock_flags_mask(page, page_to_pfn(page),
>> + MIGRATETYPE_MASK);
>> +#ifdef CONFIG_MEMORY_ISOLATION
>> + if (flags & PB_migrate_isolate_bit)
>> + return MIGRATE_ISOLATE;
>> +#endif
>> + return flags;
>> +}
>
> Can we just do get_pageblock_migratetype(page, page_to_pfn(page)) here?
Based on my observation, the callers all have page and pfn, so using the
current implementation would save a call to page_to_pfn(). I can add a comment
to this function.
/*
* Use get_pageblock_migratetype() if caller already has both @page and @pfn
* to save a call to page_to_pfn().
*/
>
>> static __always_inline int get_pfnblock_migratetype(const struct page *page,
>> unsigned long pfn)
>> {
>> - return get_pfnblock_flags_mask(page, pfn, MIGRATETYPE_MASK);
>> + unsigned long flags;
>> +
>> + flags = get_pfnblock_flags_mask(page, pfn,
>> + MIGRATETYPE_MASK);
>> +#ifdef CONFIG_MEMORY_ISOLATION
>> + if (flags & PB_migrate_isolate_bit)
>> + return MIGRATE_ISOLATE;
>> +#endif
>> + return flags;
>> }
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2025-05-13 14:53 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-09 20:01 [PATCH v4 0/4] Make MIGRATE_ISOLATE " 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 [this message]
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
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=BFE3232B-1BAD-4C21-8C74-3C22CEF7A95F@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