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

"David Hildenbrand (Arm)" <[email protected]>
Newsgroups org.kernel.vger.linux-arch,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On 7/6/26 13:52, Li Zhe wrote:
> On Mon, Jul 6, 2026 at 11:15:36AM +0200, [email protected] 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.