Re: [PATCH 1/2] mm: Constify folio_order()/folio_test_pmd_mappable()
From: Zi Yan
Date: Wed Jun 26 2024 - 07:19:31 EST
On Wed Jun 26, 2024 at 12:30 AM EDT, ran xiaokai wrote:
> > On Tue Jun 25, 2024 at 10:49 PM EDT, ran xiaokai wrote:
> > > From: Ran Xiaokai <ran.xiaokai@xxxxxxxxxx>
> > >
> > > Constify folio_order()/folio_test_pmd_mappable().
> > > No functional changes, just a preparation for the next patch.
> >
> > What warning/error are you seeing when you just apply patch 2? I wonder why it
> > did not show up in other places. Thanks.
>
> fs/proc/page.c: In function 'stable_page_flags':
> fs/proc/page.c:152:35: warning: passing argument 1 of 'folio_test_pmd_mappable' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
> 152 | else if (folio_test_pmd_mappable(folio)) {
> | ^~~~~
> In file included from include/linux/mm.h:1115,
> from include/linux/memblock.h:12,
> from fs/proc/page.c:2:
> include/linux/huge_mm.h:380:58: note: expected 'struct folio *' but argument is of type 'const struct folio *'
> 380 | static inline bool folio_test_pmd_mappable(struct folio *folio)
>
> u64 stable_page_flags(const struct page *page)
> {
> const struct folio *folio; // the const definition causes the warning
> ...
Please include the warning in the commit log to explain the change.
> }
>
> As almost all the folio_test_XXX(flags) have converted to received
> a const parameter, it is Ok to also do this for folio_order()?
Yes.
Attachment:
signature.asc
Description: PGP signature