Re: [PATCH v5 3/8] mm: add a set_page_section_from_pfn() helper

From: David Hildenbrand (Arm)

Date: Mon Jul 06 2026 - 10:22:12 EST


On 7/6/26 13:52, Li Zhe wrote:
> On Mon, Jul 6, 2026 at 11:15:36AM +0200, david@xxxxxxxxxx wrote:
>
>>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>>> index 485df9c2dbdd..f78afa63dd3d 100644
>>> --- a/include/linux/mm.h
>>> +++ b/include/linux/mm.h
>>> @@ -2541,11 +2541,26 @@ static inline void set_page_section(struct page *page, unsigned long section)
>>> page->flags.f |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
>>> }
>>>
>>> +static inline void set_page_section_from_pfn(struct page *page,
>>> + unsigned long pfn)
>>
>> Two tab indent.
>
> Thanks, I will fix the indentation in v6.
>
>>> +{
>>> + set_page_section(page, pfn_to_section_nr(pfn));
>>> +}
>>> +
>>> static inline unsigned long memdesc_section(memdesc_flags_t mdf)
>>> {
>>> return (mdf.f >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
>>> }
>>> #else /* !SECTION_IN_PAGE_FLAGS */
>>> +static inline void set_page_section(struct page *page, unsigned long section)
>>> +{
>>> +}
>>
>> Why do we need this?
>
> The empty set_page_section() helper is not needed. I will drop it in
> v6.
>
>>> +
>>> +static inline void set_page_section_from_pfn(struct page *page,
>>> + unsigned long pfn)
>>> +{
>>> +}
>>
>> Dito.
>
> The no-op set_page_section_from_pfn() helper is still needed for
> !SECTION_IN_PAGE_FLAGS so callers can use a single helper without
> open-coding #ifdef SECTION_IN_PAGE_FLAGS at each callsite.

Sorry, I meant two-tab indent :) Why we need that was clear to me.

--
Cheers,

David