All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: Zi Yan <ziy@nvidia.com>
Cc: Wei Yang <richard.weiyang@gmail.com>,
	akpm@linux-foundation.org, david@redhat.com,
	lorenzo.stoakes@oracle.com, vbabka@suse.cz, linux-mm@kvack.org
Subject: Re: [Patch v2 2/2] mm/pageblock-flags: remove PB_migratetype_bits/PB_migrate_end
Date: Wed, 27 Aug 2025 06:43:52 +0000	[thread overview]
Message-ID: <20250827064352.o5vw3f332ptlemrg@master> (raw)
In-Reply-To: <9D5D10F9-0D76-4C31-B03C-27A3A2B526AD@nvidia.com>

On Tue, Aug 26, 2025 at 10:21:20PM -0400, Zi Yan wrote:
>On 26 Aug 2025, at 22:11, Wei Yang wrote:
>
>> enum pageblock_bits defines the meaning of pageblock bits. Currently
>> PB_migratetype_bits says the lowest 3 bits represents migratetype and
>> PB_migrate_end/MIGRATETYPE_MASK's definition rely on it with magical
>> computation.
>>
>> Remove the definition of PB_migratetype_bits/PB_migrate_end. Use
>> PB_migrate_[0|1|2] to represent lowest bits for migratetype. Then we can
>> simplify related definition.
>>
>> Also, MIGRATETYPE_AND_ISO_MASK is MIGRATETYPE_MASK add isolation bit.
>> Use MIGRATETYPE_MASK in the definition of MIGRATETYPE_AND_ISO_MASK looks
>> cleaner.
>>
>> No functional change intended.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> Cc: Zi Yan <ziy@nvidia.com>
>> Cc: Vlastimil Babka <vbabka@suse.cz>
>> Cc: David Hildenbrand <david@redhat.com>
>> Suggested-by: David Hildenbrand <david@redhat.com>
>>
>> ---
>> v2: remove PB_migratetype_bits and PB_migrate_end
>> ---
>>  include/linux/pageblock-flags.h | 12 +++++-------
>>  mm/page_alloc.c                 |  4 ++--
>>  2 files changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
>> index 6a44be0f39f4..6e4c2da15706 100644
>> --- a/include/linux/pageblock-flags.h
>> +++ b/include/linux/pageblock-flags.h
>> @@ -13,12 +13,11 @@
>>
>>  #include <linux/types.h>
>>
>> -#define PB_migratetype_bits 3
>>  /* Bit indices that affect a whole block of pages */
>>  enum pageblock_bits {
>> -	PB_migrate,
>> -	PB_migrate_end = PB_migrate + PB_migratetype_bits - 1,
>> -			/* 3 bits required for migrate types */
>> +	PB_migrate_0,
>> +	PB_migrate_1,
>> +	PB_migrate_2,
>>  	PB_compact_skip,/* If set the block is skipped by compaction */
>>
>>  #ifdef CONFIG_MEMORY_ISOLATION
>> @@ -37,11 +36,10 @@ enum pageblock_bits {
>>
>>  #define NR_PAGEBLOCK_BITS (roundup_pow_of_two(__NR_PAGEBLOCK_BITS))
>>
>> -#define MIGRATETYPE_MASK ((1UL << (PB_migrate_end + 1)) - 1)
>> +#define MIGRATETYPE_MASK (PB_migrate_0|PB_migrate_1|PB_migrate_2)
>
>I think David meant
>
>#define MIGRATETYPE_MASK (BIT(PB_migrate_0)|BIT(PB_migrate_1)|BIT(PB_migrate_2))
>

Oops, I thinks you are right.

-- 
Wei Yang
Help you, Help me


  reply	other threads:[~2025-08-27  6:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  2:11 [Patch v2 0/2] mm/pageblock: improve readability of some pageblock handling Wei Yang
2025-08-27  2:11 ` [Patch v2 1/2] mm/page_alloc: use xxx_pageblock_isolate() for better reading Wei Yang
2025-08-27  9:33   ` Vlastimil Babka
2025-08-27  2:11 ` [Patch v2 2/2] mm/pageblock-flags: remove PB_migratetype_bits/PB_migrate_end Wei Yang
2025-08-27  2:21   ` Zi Yan
2025-08-27  6:43     ` Wei Yang [this message]
2025-08-27  9:16       ` David Hildenbrand
2025-08-27 14:41         ` Wei Yang
2025-08-27  9:17     ` David Hildenbrand
2025-08-27  9:38   ` Vlastimil Babka
2025-08-27  8:04 ` [syzbot ci] Re: mm/pageblock: improve readability of some pageblock handling syzbot ci
2025-08-27 14:43   ` Wei Yang
  -- strict thread matches above, loose matches on Subject: below --
2025-08-27  6:49 [Patch v2 2/2] mm/pageblock-flags: remove PB_migratetype_bits/PB_migrate_end kernel test robot

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=20250827064352.o5vw3f332ptlemrg@master \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=vbabka@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.