* [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
@ 2025-12-04 10:28 Arnd Bergmann
2025-12-04 10:34 ` David Hildenbrand (Red Hat)
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Arnd Bergmann @ 2025-12-04 10:28 UTC (permalink / raw)
To: Hugh Dickins, Andrew Morton, Pratyush Yadav,
Mike Rapoport (Microsoft),
Pasha Tatashin
Cc: Arnd Bergmann, Baolin Wang, Kairui Song, David Hildenbrand,
Christian Brauner, Lorenzo Stoakes, Kemeng Shi, Guo Weikang,
linux-mm, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The newly added 'flags' variable is unused and causes a warning if
CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
into does nothing:
mm/shmem.c: In function '__shmem_file_setup':
mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
| ^~~~~
Replace the two macros with equivalent inline functions tto get the
argument checking.
Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: make shmem_unacct_size() inline as well.
---
mm/shmem.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index 3f194c9842a8..b329b5302c48 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5794,8 +5794,15 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
#define shmem_vm_ops generic_file_vm_ops
#define shmem_anon_vm_ops generic_file_vm_ops
#define shmem_file_operations ramfs_file_operations
-#define shmem_acct_size(flags, size) 0
-#define shmem_unacct_size(flags, size) do {} while (0)
+
+static inline int shmem_acct_size(unsigned long flags, loff_t size)
+{
+ return 0;
+}
+
+static inline void shmem_unacct_size(unsigned long flags, loff_t size)
+{
+}
static inline struct inode *shmem_get_inode(struct mnt_idmap *idmap,
struct super_block *sb, struct inode *dir,
--
2.39.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:28 [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n Arnd Bergmann
@ 2025-12-04 10:34 ` David Hildenbrand (Red Hat)
2025-12-04 10:41 ` Arnd Bergmann
2025-12-04 10:55 ` Mike Rapoport
2025-12-04 10:55 ` Mike Rapoport
` (3 subsequent siblings)
4 siblings, 2 replies; 10+ messages in thread
From: David Hildenbrand (Red Hat) @ 2025-12-04 10:34 UTC (permalink / raw)
To: Arnd Bergmann, Hugh Dickins, Andrew Morton, Pratyush Yadav,
Mike Rapoport (Microsoft),
Pasha Tatashin
Cc: Arnd Bergmann, Baolin Wang, Kairui Song, Christian Brauner,
Lorenzo Stoakes, Kemeng Shi, Guo Weikang, linux-mm, linux-kernel
On 12/4/25 11:28, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added 'flags' variable is unused and causes a warning if
> CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
> into does nothing:
>
> mm/shmem.c: In function '__shmem_file_setup':
> mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
> 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
> | ^~~~~
>
> Replace the two macros with equivalent inline functions tto get the
> argument checking.
>
> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
That's still not upstream, right?
$ git tag --contains 6ff1610ced56
mm-everything-2025-11-29-19-43
mm-everything-2025-12-03-23-49
next-20251201
next-20251203
next-20251204
So we can likely just squash it into the problematic commit before
proceeding with it?
Thanks Arnd!
--
Cheers
David
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:34 ` David Hildenbrand (Red Hat)
@ 2025-12-04 10:41 ` Arnd Bergmann
2025-12-04 10:55 ` Mike Rapoport
1 sibling, 0 replies; 10+ messages in thread
From: Arnd Bergmann @ 2025-12-04 10:41 UTC (permalink / raw)
To: David Hildenbrand (Red Hat),
Arnd Bergmann, Hugh Dickins, Andrew Morton, Pratyush Yadav,
Mike Rapoport, Pasha Tatashin
Cc: Baolin Wang, Kairui Song, Christian Brauner, Lorenzo Stoakes,
Kemeng Shi, Guo Weikang, linux-mm, linux-kernel
On Thu, Dec 4, 2025, at 11:34, David Hildenbrand (Red Hat) wrote:
>
> So we can likely just squash it into the problematic commit before
> proceeding with it?
Yes, that would be best.
Arnd
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:34 ` David Hildenbrand (Red Hat)
2025-12-04 10:41 ` Arnd Bergmann
@ 2025-12-04 10:55 ` Mike Rapoport
2025-12-04 11:03 ` David Hildenbrand (Red Hat)
1 sibling, 1 reply; 10+ messages in thread
From: Mike Rapoport @ 2025-12-04 10:55 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: Arnd Bergmann, Hugh Dickins, Andrew Morton, Pratyush Yadav,
Pasha Tatashin, Arnd Bergmann, Baolin Wang, Kairui Song,
Christian Brauner, Lorenzo Stoakes, Kemeng Shi, Guo Weikang,
linux-mm, linux-kernel
On Thu, Dec 04, 2025 at 11:34:24AM +0100, David Hildenbrand (Red Hat) wrote:
> On 12/4/25 11:28, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The newly added 'flags' variable is unused and causes a warning if
> > CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
> > into does nothing:
> >
> > mm/shmem.c: In function '__shmem_file_setup':
> > mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
> > 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
> > | ^~~~~
> >
> > Replace the two macros with equivalent inline functions tto get the
> > argument checking.
> >
> > Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
>
> That's still not upstream, right?
>
> $ git tag --contains 6ff1610ced56
> mm-everything-2025-11-29-19-43
> mm-everything-2025-12-03-23-49
> next-20251201
> next-20251203
> next-20251204
>
> So we can likely just squash it into the problematic commit before
> proceeding with it?
It's mm-nonmm-stable, I don't think fixups can go there.
> Thanks Arnd!
>
> --
> Cheers
>
> David
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:28 [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n Arnd Bergmann
2025-12-04 10:34 ` David Hildenbrand (Red Hat)
@ 2025-12-04 10:55 ` Mike Rapoport
2025-12-04 12:38 ` Baolin Wang
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Mike Rapoport @ 2025-12-04 10:55 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Hugh Dickins, Andrew Morton, Pratyush Yadav, Pasha Tatashin,
Arnd Bergmann, Baolin Wang, Kairui Song, David Hildenbrand,
Christian Brauner, Lorenzo Stoakes, Kemeng Shi, Guo Weikang,
linux-mm, linux-kernel
On Thu, Dec 04, 2025 at 11:28:59AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added 'flags' variable is unused and causes a warning if
> CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
> into does nothing:
>
> mm/shmem.c: In function '__shmem_file_setup':
> mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
> 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
> | ^~~~~
>
> Replace the two macros with equivalent inline functions tto get the
> argument checking.
>
> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> v2: make shmem_unacct_size() inline as well.
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:55 ` Mike Rapoport
@ 2025-12-04 11:03 ` David Hildenbrand (Red Hat)
2025-12-04 13:34 ` Pratyush Yadav
0 siblings, 1 reply; 10+ messages in thread
From: David Hildenbrand (Red Hat) @ 2025-12-04 11:03 UTC (permalink / raw)
To: Mike Rapoport
Cc: Arnd Bergmann, Hugh Dickins, Andrew Morton, Pratyush Yadav,
Pasha Tatashin, Arnd Bergmann, Baolin Wang, Kairui Song,
Christian Brauner, Lorenzo Stoakes, Kemeng Shi, Guo Weikang,
linux-mm, linux-kernel
On 12/4/25 11:55, Mike Rapoport wrote:
> On Thu, Dec 04, 2025 at 11:34:24AM +0100, David Hildenbrand (Red Hat) wrote:
>> On 12/4/25 11:28, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> The newly added 'flags' variable is unused and causes a warning if
>>> CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
>>> into does nothing:
>>>
>>> mm/shmem.c: In function '__shmem_file_setup':
>>> mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
>>> 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
>>> | ^~~~~
>>>
>>> Replace the two macros with equivalent inline functions tto get the
>>> argument checking.
>>>
>>> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
>>
>> That's still not upstream, right?
>>
>> $ git tag --contains 6ff1610ced56
>> mm-everything-2025-11-29-19-43
>> mm-everything-2025-12-03-23-49
>> next-20251201
>> next-20251203
>> next-20251204
>>
>> So we can likely just squash it into the problematic commit before
>> proceeding with it?
>
> It's mm-nonmm-stable, I don't think fixups can go there.
Ah, I only looked at mm-stable and mm-unstable.
Confused why this is in nomm-stable and not mm-stable.
Anyhow:
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
--
Cheers
David
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:28 [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n Arnd Bergmann
2025-12-04 10:34 ` David Hildenbrand (Red Hat)
2025-12-04 10:55 ` Mike Rapoport
@ 2025-12-04 12:38 ` Baolin Wang
2025-12-04 13:31 ` Pratyush Yadav
2025-12-04 14:10 ` Pasha Tatashin
4 siblings, 0 replies; 10+ messages in thread
From: Baolin Wang @ 2025-12-04 12:38 UTC (permalink / raw)
To: Arnd Bergmann, Hugh Dickins, Andrew Morton, Pratyush Yadav,
Mike Rapoport (Microsoft),
Pasha Tatashin
Cc: Arnd Bergmann, Kairui Song, David Hildenbrand, Christian Brauner,
Lorenzo Stoakes, Kemeng Shi, Guo Weikang, linux-mm, linux-kernel
On 2025/12/4 18:28, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added 'flags' variable is unused and causes a warning if
> CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
> into does nothing:
>
> mm/shmem.c: In function '__shmem_file_setup':
> mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
> 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
> | ^~~~~
>
> Replace the two macros with equivalent inline functions tto get the
> argument checking.
>
> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: make shmem_unacct_size() inline as well.
> ---
LGTM. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:28 [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n Arnd Bergmann
` (2 preceding siblings ...)
2025-12-04 12:38 ` Baolin Wang
@ 2025-12-04 13:31 ` Pratyush Yadav
2025-12-04 14:10 ` Pasha Tatashin
4 siblings, 0 replies; 10+ messages in thread
From: Pratyush Yadav @ 2025-12-04 13:31 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Hugh Dickins, Andrew Morton, Pratyush Yadav,
Mike Rapoport (Microsoft),
Pasha Tatashin, Arnd Bergmann, Baolin Wang, Kairui Song,
David Hildenbrand, Christian Brauner, Lorenzo Stoakes,
Kemeng Shi, Guo Weikang, linux-mm, linux-kernel
On Thu, Dec 04 2025, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added 'flags' variable is unused and causes a warning if
> CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
> into does nothing:
>
> mm/shmem.c: In function '__shmem_file_setup':
> mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
> 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
> | ^~~~~
>
> Replace the two macros with equivalent inline functions tto get the
> argument checking.
>
> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
[...]
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 11:03 ` David Hildenbrand (Red Hat)
@ 2025-12-04 13:34 ` Pratyush Yadav
0 siblings, 0 replies; 10+ messages in thread
From: Pratyush Yadav @ 2025-12-04 13:34 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: Mike Rapoport, Arnd Bergmann, Hugh Dickins, Andrew Morton,
Pratyush Yadav, Pasha Tatashin, Arnd Bergmann, Baolin Wang,
Kairui Song, Christian Brauner, Lorenzo Stoakes, Kemeng Shi,
Guo Weikang, linux-mm, linux-kernel
On Thu, Dec 04 2025, David Hildenbrand (Red Hat) wrote:
> On 12/4/25 11:55, Mike Rapoport wrote:
>> On Thu, Dec 04, 2025 at 11:34:24AM +0100, David Hildenbrand (Red Hat) wrote:
>>> On 12/4/25 11:28, Arnd Bergmann wrote:
>>>> From: Arnd Bergmann <arnd@arndb.de>
>>>>
>>>> The newly added 'flags' variable is unused and causes a warning if
>>>> CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
>>>> into does nothing:
>>>>
>>>> mm/shmem.c: In function '__shmem_file_setup':
>>>> mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
>>>> 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
>>>> | ^~~~~
>>>>
>>>> Replace the two macros with equivalent inline functions tto get the
>>>> argument checking.
>>>>
>>>> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
>>>
>>> That's still not upstream, right?
>>>
>>> $ git tag --contains 6ff1610ced56
>>> mm-everything-2025-11-29-19-43
>>> mm-everything-2025-12-03-23-49
>>> next-20251201
>>> next-20251203
>>> next-20251204
>>>
>>> So we can likely just squash it into the problematic commit before
>>> proceeding with it?
>> It's mm-nonmm-stable, I don't think fixups can go there.
>
> Ah, I only looked at mm-stable and mm-unstable.
>
> Confused why this is in nomm-stable and not mm-stable.
The patch came in with the liveupdate series [0], most of which counts
as nonmm I suppose.
[0] https://lore.kernel.org/all/20251125165850.3389713-1-pasha.tatashin@soleen.com/
[...]
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
2025-12-04 10:28 [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n Arnd Bergmann
` (3 preceding siblings ...)
2025-12-04 13:31 ` Pratyush Yadav
@ 2025-12-04 14:10 ` Pasha Tatashin
4 siblings, 0 replies; 10+ messages in thread
From: Pasha Tatashin @ 2025-12-04 14:10 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Hugh Dickins, Andrew Morton, Pratyush Yadav,
Mike Rapoport (Microsoft),
Arnd Bergmann, Baolin Wang, Kairui Song, David Hildenbrand,
Christian Brauner, Lorenzo Stoakes, Kemeng Shi, Guo Weikang,
linux-mm, linux-kernel
On Thu, Dec 4, 2025 at 5:29 AM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The newly added 'flags' variable is unused and causes a warning if
> CONFIG_SHMEM is disabled, since the shmem_acct_size() macro it is passed
> into does nothing:
>
> mm/shmem.c: In function '__shmem_file_setup':
> mm/shmem.c:5816:23: error: unused variable 'flags' [-Werror=unused-variable]
> 5816 | unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
> | ^~~~~
>
> Replace the two macros with equivalent inline functions tto get the
> argument checking.
>
> Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: make shmem_unacct_size() inline as well.
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
for v2 as well, thank you for the fixes! :-)
> ---
> mm/shmem.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 3f194c9842a8..b329b5302c48 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -5794,8 +5794,15 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
> #define shmem_vm_ops generic_file_vm_ops
> #define shmem_anon_vm_ops generic_file_vm_ops
> #define shmem_file_operations ramfs_file_operations
> -#define shmem_acct_size(flags, size) 0
> -#define shmem_unacct_size(flags, size) do {} while (0)
> +
> +static inline int shmem_acct_size(unsigned long flags, loff_t size)
> +{
> + return 0;
> +}
> +
> +static inline void shmem_unacct_size(unsigned long flags, loff_t size)
> +{
> +}
>
> static inline struct inode *shmem_get_inode(struct mnt_idmap *idmap,
> struct super_block *sb, struct inode *dir,
> --
> 2.39.5
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-12-04 14:11 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-04 10:28 [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n Arnd Bergmann
2025-12-04 10:34 ` David Hildenbrand (Red Hat)
2025-12-04 10:41 ` Arnd Bergmann
2025-12-04 10:55 ` Mike Rapoport
2025-12-04 11:03 ` David Hildenbrand (Red Hat)
2025-12-04 13:34 ` Pratyush Yadav
2025-12-04 10:55 ` Mike Rapoport
2025-12-04 12:38 ` Baolin Wang
2025-12-04 13:31 ` Pratyush Yadav
2025-12-04 14:10 ` Pasha Tatashin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox