linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build warning after merge of the mm-unstable tree
@ 2025-05-09  9:43 Stephen Rothwell
  2025-05-09 20:31 ` Andrew Morton
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2025-05-09  9:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Juan Yescas, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]

Hi all,

After merging the mm-unstable tree, today's linux-next build (powerpc64
allnoconfig) produced this warning:

In file included from include/vdso/const.h:5,
                 from include/linux/const.h:4,
                 from include/linux/bits.h:5,
                 from include/linux/ratelimit_types.h:5,
                 from include/linux/printk.h:9,
                 from include/asm-generic/bug.h:22,
                 from arch/powerpc/include/asm/bug.h:116,
                 from include/linux/bug.h:5,
                 from include/linux/mmdebug.h:5,
                 from include/linux/mm.h:6,
                 from mm/sparse.c:5:
mm/sparse.c: In function 'usemap_size':
include/linux/mmzone.h:1815:15: warning: left shift count is negative [-Wshift-count-negative]
 1815 |         ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
      |               ^~
include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
   51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
      |                                        ^
mm/sparse.c:301:16: note: in expansion of macro 'BITS_TO_LONGS'
  301 |         return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
      |                ^~~~~~~~~~~~~
mm/sparse.c:301:30: note: in expansion of macro 'SECTION_BLOCKFLAGS_BITS'
  301 |         return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~

Probably introduced by commit

 ("mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order")

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-05-09  9:43 Stephen Rothwell
@ 2025-05-09 20:31 ` Andrew Morton
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Morton @ 2025-05-09 20:31 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Juan Yescas, Linux Kernel Mailing List, Linux Next Mailing List

On Fri, 9 May 2025 19:43:36 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> After merging the mm-unstable tree, today's linux-next build (powerpc64
> allnoconfig) produced this warning:
> 
> In file included from include/vdso/const.h:5,
>                  from include/linux/const.h:4,
>                  from include/linux/bits.h:5,
>                  from include/linux/ratelimit_types.h:5,
>                  from include/linux/printk.h:9,
>                  from include/asm-generic/bug.h:22,
>                  from arch/powerpc/include/asm/bug.h:116,
>                  from include/linux/bug.h:5,
>                  from include/linux/mmdebug.h:5,
>                  from include/linux/mm.h:6,
>                  from mm/sparse.c:5:
> mm/sparse.c: In function 'usemap_size':
> include/linux/mmzone.h:1815:15: warning: left shift count is negative [-Wshift-count-negative]
>  1815 |         ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
>       |               ^~
> include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
>    51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
>       |                                        ^
> mm/sparse.c:301:16: note: in expansion of macro 'BITS_TO_LONGS'
>   301 |         return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
>       |                ^~~~~~~~~~~~~
> mm/sparse.c:301:30: note: in expansion of macro 'SECTION_BLOCKFLAGS_BITS'
>   301 |         return BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS) * sizeof(unsigned long);
>       |                              ^~~~~~~~~~~~~~~~~~~~~~~
> 
> Probably introduced by commit
> 
>  ("mm: add CONFIG_PAGE_BLOCK_ORDER to select page block order")
> 

Yes, thanks, I'll drop this version of the patch.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* linux-next: build warning after merge of the mm-unstable tree
@ 2025-06-10  4:33 Stephen Rothwell
  2025-06-10  4:35 ` Christoph Hellwig
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2025-06-10  4:33 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

Hi all,

After merging the mm-unstable tree, today's linux-next build (hmldocs)
failed like this:

mm/shmem.c:1551: warning: Excess function parameter 'wbc' description in 'shmem_writeout'

Caused by commit

  7140d202bf58 ("mm: stop passing a writeback_control structure to shmem_writeout")

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-06-10  4:33 Stephen Rothwell
@ 2025-06-10  4:35 ` Christoph Hellwig
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2025-06-10  4:35 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Andrew Morton, Christoph Hellwig, Linux Kernel Mailing List,
	Linux Next Mailing List

On Tue, Jun 10, 2025 at 02:33:46PM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the mm-unstable tree, today's linux-next build (hmldocs)
> failed like this:
> 
> mm/shmem.c:1551: warning: Excess function parameter 'wbc' description in 'shmem_writeout'

Yeah, that's just gone.  Let me fix this and resend the series now that
we have a stable base.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* linux-next: build warning after merge of the mm-unstable tree
@ 2025-07-10  7:50 Stephen Rothwell
  2025-07-11  9:57 ` David Hildenbrand
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2025-07-10  7:50 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Hildenbrand, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

Hi all,

After merging the mm-unstable tree, today's linux-next build (htmldocs)
produced this warning:

include/linux/page-flags.h:1161: warning: Function parameter or struct member 'page' not described in 'page_has_movable_ops'

Introduced by commit

  7a93faa2375d ("mm: convert "movable" flag in page->mapping to a page flag")

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* linux-next: build warning after merge of the mm-unstable tree
@ 2025-07-10  7:54 Stephen Rothwell
  2025-07-10 22:30 ` Andrew Morton
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2025-07-10  7:54 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Hildenbrand, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

Hi all,

After merging the mm-unstable tree, today's linux-next build (htmldocs)
produced this warning:

mm/migrate.c:215: warning: Function parameter or struct member 'dst' not described in 'migrate_movable_ops_page'
mm/migrate.c:215: warning: Function parameter or struct member 'src' not described in 'migrate_movable_ops_page'
mm/migrate.c:215: warning: Function parameter or struct member 'mode' not described in 'migrate_movable_ops_page'
mm/migrate.c:215: warning: Excess function parameter 'page' description in 'migrate_movable_ops_page'

Introduced by commit

  d5967fb0bf8e ("mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page()")

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-07-10  7:54 linux-next: build warning after merge of the mm-unstable tree Stephen Rothwell
@ 2025-07-10 22:30 ` Andrew Morton
  2025-07-10 22:49   ` Stephen Rothwell
                     ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Andrew Morton @ 2025-07-10 22:30 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: David Hildenbrand, Linux Kernel Mailing List,
	Linux Next Mailing List

On Thu, 10 Jul 2025 17:54:46 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> After merging the mm-unstable tree, today's linux-next build (htmldocs)
> produced this warning:
> 
> mm/migrate.c:215: warning: Function parameter or struct member 'dst' not described in 'migrate_movable_ops_page'
> mm/migrate.c:215: warning: Function parameter or struct member 'src' not described in 'migrate_movable_ops_page'
> mm/migrate.c:215: warning: Function parameter or struct member 'mode' not described in 'migrate_movable_ops_page'
> mm/migrate.c:215: warning: Excess function parameter 'page' description in 'migrate_movable_ops_page'
> 
> Introduced by commit
> 
>   d5967fb0bf8e ("mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page()")

How about this?

--- a/mm/migrate.c~mm-migrate-factor-out-movable_ops-page-handling-into-migrate_movable_ops_page-fix
+++ a/mm/migrate.c
@@ -161,7 +161,9 @@ static void putback_movable_ops_page(str
 
 /**
  * migrate_movable_ops_page - migrate an isolated movable_ops page
- * @page: The isolated page.
+ * @dst: The destination page.
+ * @src: The source page.
+ * @mode: The migration mode.
  *
  * Migrate an isolated movable_ops page.
  *
_


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-07-10 22:30 ` Andrew Morton
@ 2025-07-10 22:49   ` Stephen Rothwell
  2025-07-11  0:36   ` Randy Dunlap
  2025-07-11  6:28   ` David Hildenbrand
  2 siblings, 0 replies; 16+ messages in thread
From: Stephen Rothwell @ 2025-07-10 22:49 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Hildenbrand, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

Hi Andrew,

On Thu, 10 Jul 2025 15:30:17 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
>
> How about this?
> 
> --- a/mm/migrate.c~mm-migrate-factor-out-movable_ops-page-handling-into-migrate_movable_ops_page-fix
> +++ a/mm/migrate.c
> @@ -161,7 +161,9 @@ static void putback_movable_ops_page(str
>  
>  /**
>   * migrate_movable_ops_page - migrate an isolated movable_ops page
> - * @page: The isolated page.
> + * @dst: The destination page.
> + * @src: The source page.
> + * @mode: The migration mode.
>   *
>   * Migrate an isolated movable_ops page.
>   *
> _
> 

Looks good to me (but I haven't actually tested it).

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-07-10 22:30 ` Andrew Morton
  2025-07-10 22:49   ` Stephen Rothwell
@ 2025-07-11  0:36   ` Randy Dunlap
  2025-07-11  6:28   ` David Hildenbrand
  2 siblings, 0 replies; 16+ messages in thread
From: Randy Dunlap @ 2025-07-11  0:36 UTC (permalink / raw)
  To: Andrew Morton, Stephen Rothwell
  Cc: David Hildenbrand, Linux Kernel Mailing List,
	Linux Next Mailing List



On 7/10/25 3:30 PM, Andrew Morton wrote:
> On Thu, 10 Jul 2025 17:54:46 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
>> Hi all,
>>
>> After merging the mm-unstable tree, today's linux-next build (htmldocs)
>> produced this warning:
>>
>> mm/migrate.c:215: warning: Function parameter or struct member 'dst' not described in 'migrate_movable_ops_page'
>> mm/migrate.c:215: warning: Function parameter or struct member 'src' not described in 'migrate_movable_ops_page'
>> mm/migrate.c:215: warning: Function parameter or struct member 'mode' not described in 'migrate_movable_ops_page'
>> mm/migrate.c:215: warning: Excess function parameter 'page' description in 'migrate_movable_ops_page'
>>
>> Introduced by commit
>>
>>   d5967fb0bf8e ("mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page()")
> 
> How about this?
> 
> --- a/mm/migrate.c~mm-migrate-factor-out-movable_ops-page-handling-into-migrate_movable_ops_page-fix
> +++ a/mm/migrate.c
> @@ -161,7 +161,9 @@ static void putback_movable_ops_page(str
>  
>  /**
>   * migrate_movable_ops_page - migrate an isolated movable_ops page
> - * @page: The isolated page.
> + * @dst: The destination page.
> + * @src: The source page.
> + * @mode: The migration mode.
>   *
>   * Migrate an isolated movable_ops page.
>   *
> _

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>

-- 
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-07-10 22:30 ` Andrew Morton
  2025-07-10 22:49   ` Stephen Rothwell
  2025-07-11  0:36   ` Randy Dunlap
@ 2025-07-11  6:28   ` David Hildenbrand
  2 siblings, 0 replies; 16+ messages in thread
From: David Hildenbrand @ 2025-07-11  6:28 UTC (permalink / raw)
  To: Andrew Morton, Stephen Rothwell
  Cc: Linux Kernel Mailing List, Linux Next Mailing List

On 11.07.25 00:30, Andrew Morton wrote:
> On Thu, 10 Jul 2025 17:54:46 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
>> Hi all,
>>
>> After merging the mm-unstable tree, today's linux-next build (htmldocs)
>> produced this warning:
>>

Hi,

>> mm/migrate.c:215: warning: Function parameter or struct member 'dst' not described in 'migrate_movable_ops_page'
>> mm/migrate.c:215: warning: Function parameter or struct member 'src' not described in 'migrate_movable_ops_page'
>> mm/migrate.c:215: warning: Function parameter or struct member 'mode' not described in 'migrate_movable_ops_page'
>> mm/migrate.c:215: warning: Excess function parameter 'page' description in 'migrate_movable_ops_page'
>>
>> Introduced by commit
>>
>>    d5967fb0bf8e ("mm/migrate: factor out movable_ops page handling into migrate_movable_ops_page()")
> 

Thanks Andrew for taking care of this, was out the last two days.

> How about this?
> 
> --- a/mm/migrate.c~mm-migrate-factor-out-movable_ops-page-handling-into-migrate_movable_ops_page-fix
> +++ a/mm/migrate.c
> @@ -161,7 +161,9 @@ static void putback_movable_ops_page(str
>   
>   /**
>    * migrate_movable_ops_page - migrate an isolated movable_ops page
> - * @page: The isolated page.
> + * @dst: The destination page.
> + * @src: The source page.
> + * @mode: The migration mode.


LGTM, thanks!


-- 
Cheers,

David / dhildenb


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-07-10  7:50 Stephen Rothwell
@ 2025-07-11  9:57 ` David Hildenbrand
  0 siblings, 0 replies; 16+ messages in thread
From: David Hildenbrand @ 2025-07-11  9:57 UTC (permalink / raw)
  To: Stephen Rothwell, Andrew Morton
  Cc: Linux Kernel Mailing List, Linux Next Mailing List

On 10.07.25 09:50, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the mm-unstable tree, today's linux-next build (htmldocs)
> produced this warning:
> 
> include/linux/page-flags.h:1161: warning: Function parameter or struct member 'page' not described in 'page_has_movable_ops'
> 
> Introduced by commit
> 
>    7a93faa2375d ("mm: convert "movable" flag in page->mapping to a page flag")
> 

Ah, there is a ":" missing.

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 970600d79daca..8e4d6eda8a8d6 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -1150,7 +1150,7 @@ PAGEFLAG_FALSE(MovableOpsIsolated, 
movable_ops_isolated);

  /**
   * page_has_movable_ops - test for a movable_ops page
- * @page The page to test.
+ * @page: The page to test.
   *
   * Test whether this is a movable_ops page. Such pages will stay that
   * way until freed.


-- 
Cheers,

David / dhildenb


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* linux-next: build warning after merge of the mm-unstable tree
@ 2025-07-15  8:55 Stephen Rothwell
  2025-07-15 18:54 ` SeongJae Park
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2025-07-15  8:55 UTC (permalink / raw)
  To: Andrew Morton
  Cc: SeongJae Park, Linux Kernel Mailing List, Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Hi all,

After merging the mm-unstable tree, today's linux-next build (htmldocs)
produced this warning:

include/linux/damon.h:629: warning: Function parameter or struct member 'cleanup_target' not described in 'damon_operations'
include/linux/damon.h:794: warning: Excess struct member 'callback' description in 'damon_ctx'

Introduced by commits

  dff2bc66ec7b ("mm/damon/core: remove damon_callback")
  769bd386e490 ("mm/damon/core: add cleanup_target() ops callback")

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-07-15  8:55 Stephen Rothwell
@ 2025-07-15 18:54 ` SeongJae Park
  0 siblings, 0 replies; 16+ messages in thread
From: SeongJae Park @ 2025-07-15 18:54 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: SeongJae Park, Andrew Morton, Linux Kernel Mailing List,
	Linux Next Mailing List

Hello Stephen,

On Tue, 15 Jul 2025 18:55:49 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> After merging the mm-unstable tree, today's linux-next build (htmldocs)
> produced this warning:
> 
> include/linux/damon.h:629: warning: Function parameter or struct member 'cleanup_target' not described in 'damon_operations'
> include/linux/damon.h:794: warning: Excess struct member 'callback' description in 'damon_ctx'
> 
> Introduced by commits
> 
>   dff2bc66ec7b ("mm/damon/core: remove damon_callback")
>   769bd386e490 ("mm/damon/core: add cleanup_target() ops callback")

Thank you for reporting, Stephen!  I just sent fixes:
https://lore.kernel.org/20250712204650.155988-1-sj@kernel.org


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* linux-next: build warning after merge of the mm-unstable tree
@ 2025-09-04  2:14 Stephen Rothwell
  2025-09-04  2:59 ` Andrew Morton
  0 siblings, 1 reply; 16+ messages in thread
From: Stephen Rothwell @ 2025-09-04  2:14 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Max Kellermann, Linux Kernel Mailing List,
	Linux Next Mailing List

[-- Attachment #1: Type: text/plain, Size: 1483 bytes --]

Hi all,

After merging the mm-unstable tree, today's linux-next build (arm
multi_v7_defconfig) produced this warning:

In file included from include/linux/highmem.h:14,
                 from include/linux/bvec.h:10,
                 from include/linux/blk_types.h:10,
                 from include/linux/writeback.h:13,
                 from include/linux/memcontrol.h:23,
                 from include/linux/swap.h:9,
                 from include/linux/suspend.h:5,
                 from arch/arm/mach-highbank/pm.c:9:
include/linux/highmem-internal.h: In function 'kmap_local_folio':
include/linux/highmem-internal.h:86:46: warning: passing argument 1 of 'folio_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
   86 |         const struct page *page = folio_page(folio, offset / PAGE_SIZE);
      |                                              ^~~~~
In file included from include/linux/mmzone.h:23,
                 from include/linux/swap.h:7:
include/linux/page-flags.h:319:53: note: expected 'struct folio *' but argument is of type 'const struct folio *'
  319 | static inline struct page *folio_page(struct folio *folio, unsigned long n)
      |                                       ~~~~~~~~~~~~~~^~~~~

And 5.5MB more :-(

Introduced by commit

  598ad57d4b46 ("mm: constify highmem related functions for improved const-correctness")

I have reverted that commit for today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-09-04  2:14 Stephen Rothwell
@ 2025-09-04  2:59 ` Andrew Morton
  2025-09-04  6:33   ` David Hildenbrand
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Morton @ 2025-09-04  2:59 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Max Kellermann, Linux Kernel Mailing List,
	Linux Next Mailing List, Lorenzo Stoakes, David Hildenbrand,
	Vlastimil Babka, Mike Rapoport, Matthew Wilcox

On Thu, 4 Sep 2025 12:14:38 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> After merging the mm-unstable tree, today's linux-next build (arm
> multi_v7_defconfig) produced this warning:
> 
> In file included from include/linux/highmem.h:14,
>                  from include/linux/bvec.h:10,
>                  from include/linux/blk_types.h:10,
>                  from include/linux/writeback.h:13,
>                  from include/linux/memcontrol.h:23,
>                  from include/linux/swap.h:9,
>                  from include/linux/suspend.h:5,
>                  from arch/arm/mach-highbank/pm.c:9:
> include/linux/highmem-internal.h: In function 'kmap_local_folio':
> include/linux/highmem-internal.h:86:46: warning: passing argument 1 of 'folio_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>    86 |         const struct page *page = folio_page(folio, offset / PAGE_SIZE);
>       |                                              ^~~~~
> In file included from include/linux/mmzone.h:23,
>                  from include/linux/swap.h:7:
> include/linux/page-flags.h:319:53: note: expected 'struct folio *' but argument is of type 'const struct folio *'
>   319 | static inline struct page *folio_page(struct folio *folio, unsigned long n)


Yeah, thanks, folio_page() is a problem.  I'll do the below nasty for
now, but nasty.

--- a/include/linux/page-flags.h~mm-constify-highmem-related-functions-for-improved-const-correctness-fix
+++ a/include/linux/page-flags.h
@@ -316,9 +316,9 @@ static __always_inline unsigned long _co
  * check that the page number lies within @folio; the caller is presumed
  * to have a reference to the page.
  */
-static inline struct page *folio_page(struct folio *folio, unsigned long n)
+static inline struct page *folio_page(const struct folio *folio, unsigned long n)
 {
-	return &folio->page + n;
+	return (struct page *)(&folio->page + n);
 }
 
 static __always_inline int PageTail(const struct page *page)
_


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: linux-next: build warning after merge of the mm-unstable tree
  2025-09-04  2:59 ` Andrew Morton
@ 2025-09-04  6:33   ` David Hildenbrand
  0 siblings, 0 replies; 16+ messages in thread
From: David Hildenbrand @ 2025-09-04  6:33 UTC (permalink / raw)
  To: Andrew Morton, Stephen Rothwell
  Cc: Max Kellermann, Linux Kernel Mailing List,
	Linux Next Mailing List, Lorenzo Stoakes, Vlastimil Babka,
	Mike Rapoport, Matthew Wilcox

On 04.09.25 04:59, Andrew Morton wrote:
> On Thu, 4 Sep 2025 12:14:38 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
>> After merging the mm-unstable tree, today's linux-next build (arm
>> multi_v7_defconfig) produced this warning:
>>
>> In file included from include/linux/highmem.h:14,
>>                   from include/linux/bvec.h:10,
>>                   from include/linux/blk_types.h:10,
>>                   from include/linux/writeback.h:13,
>>                   from include/linux/memcontrol.h:23,
>>                   from include/linux/swap.h:9,
>>                   from include/linux/suspend.h:5,
>>                   from arch/arm/mach-highbank/pm.c:9:
>> include/linux/highmem-internal.h: In function 'kmap_local_folio':
>> include/linux/highmem-internal.h:86:46: warning: passing argument 1 of 'folio_page' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>>     86 |         const struct page *page = folio_page(folio, offset / PAGE_SIZE);
>>        |                                              ^~~~~
>> In file included from include/linux/mmzone.h:23,
>>                   from include/linux/swap.h:7:
>> include/linux/page-flags.h:319:53: note: expected 'struct folio *' but argument is of type 'const struct folio *'
>>    319 | static inline struct page *folio_page(struct folio *folio, unsigned long n)
> 

Hm, why did we not detect that in mm-new?
> 
> Yeah, thanks, folio_page() is a problem.  I'll do the below nasty for
> now, but nasty.
> 
> --- a/include/linux/page-flags.h~mm-constify-highmem-related-functions-for-improved-const-correctness-fix
> +++ a/include/linux/page-flags.h
> @@ -316,9 +316,9 @@ static __always_inline unsigned long _co
>    * check that the page number lies within @folio; the caller is presumed
>    * to have a reference to the page.
>    */
> -static inline struct page *folio_page(struct folio *folio, unsigned long n)
> +static inline struct page *folio_page(const struct folio *folio, unsigned long n)
>   {
> -	return &folio->page + n;
> +	return (struct page *)(&folio->page + n);
>   }
>   
>   static __always_inline int PageTail(const struct page *page)
> _

I think the problem  appears when nth_page() removal is paired with const-correctness.


Not a fan of going back to a plain macro either. Likely we can handle it similar to page_folio() and
perform the cast cleanly:


diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index faf17ca211b4f..dc67fe08e77c8 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -307,6 +307,12 @@ static __always_inline unsigned long _compound_head(const struct page *page)
         const struct page *:    (const struct folio *)_compound_head(p), \
         struct page *:          (struct folio *)_compound_head(p)))
  
+static inline const struct page *_folio_page(const struct folio *folio,
+               unsigned long n)
+{
+       return &folio->page + n;
+}
+
  /**
   * folio_page - Return a page from a folio.
   * @folio: The folio.
@@ -316,10 +322,9 @@ static __always_inline unsigned long _compound_head(const struct page *page)
   * check that the page number lies within @folio; the caller is presumed
   * to have a reference to the page.
   */
-static inline struct page *folio_page(struct folio *folio, unsigned long n)
-{
-       return &folio->page + n;
-}
+#define folio_page(f, p)       (_Generic((f),                          \
+       const struct folio *:   (const struct page *)_folio_page(f, p), \
+       struct folio *:         (struct page *)_folio_page(f, p)))
  
  static __always_inline int PageTail(const struct page *page)
  {


-- 
Cheers

David / dhildenb


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-09-04  6:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10  7:54 linux-next: build warning after merge of the mm-unstable tree Stephen Rothwell
2025-07-10 22:30 ` Andrew Morton
2025-07-10 22:49   ` Stephen Rothwell
2025-07-11  0:36   ` Randy Dunlap
2025-07-11  6:28   ` David Hildenbrand
  -- strict thread matches above, loose matches on Subject: below --
2025-09-04  2:14 Stephen Rothwell
2025-09-04  2:59 ` Andrew Morton
2025-09-04  6:33   ` David Hildenbrand
2025-07-15  8:55 Stephen Rothwell
2025-07-15 18:54 ` SeongJae Park
2025-07-10  7:50 Stephen Rothwell
2025-07-11  9:57 ` David Hildenbrand
2025-06-10  4:33 Stephen Rothwell
2025-06-10  4:35 ` Christoph Hellwig
2025-05-09  9:43 Stephen Rothwell
2025-05-09 20:31 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).