Re: [PATCH v3 4/4] mm/page_isolation: remove migratetype parameter from more functions.

From: Zi Yan
Date: Thu May 08 2025 - 18:16:12 EST


On 8 May 2025, at 17:11, Johannes Weiner wrote:

> On Wed, May 07, 2025 at 05:10:59PM -0400, Zi Yan wrote:
>> @@ -22,8 +22,17 @@ static inline bool is_migrate_isolate(int migratetype)
>> }
>> #endif
>>
>> -#define MEMORY_OFFLINE 0x1
>> -#define REPORT_FAILURE 0x2
>> +/*
>> + * Isolation flags:
>> + * MEMORY_OFFLINE - isolate to offline (!allocate) memory e.g., skip over
>> + * PageHWPoison() pages and PageOffline() pages.
>> + * REPORT_FAILURE - report details about the failure to isolate the range
>> + * CMA_ALLOCATION - isolate for CMA allocations
>> + */
>> +typedef unsigned int __bitwise isol_flags_t;
>> +#define MEMORY_OFFLINE ((__force isol_flags_t)BIT(0))
>> +#define REPORT_FAILURE ((__force isol_flags_t)BIT(1))
>> +#define CMA_ALLOCATION ((__force isol_flags_t)BIT(2))
>
> Should this be a mode enum instead? MEMORY_OFFLINE and CMA_ALLOCATION
> are exclusive modes AFAICS. REPORT_FAILURE is a flag, but it's only
> used by MEMORY_OFFLINE, so probably better to make it a part of that
> instead of having both a mode and a flag field.

Yes. Will use an enum for MEMORY_OFFLINE and CMA_ALLOCATION and
make REPORT_FAILURE as a separate flag. Thanks for the feedback.

--
Best Regards,
Yan, Zi