[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+CK2bD2HTpJm9xsL1+V=EOUkrn1QrCks+T14nB8doyDfN=JyQ@mail.gmail.com>
Date: Thu, 4 Dec 2025 09:10:43 -0500
From: Pasha Tatashin <pasha.tatashin@...een.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Hugh Dickins <hughd@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>,
Pratyush Yadav <pratyush@...nel.org>, "Mike Rapoport (Microsoft)" <rppt@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Baolin Wang <baolin.wang@...ux.alibaba.com>, Kairui Song <kasong@...cent.com>,
David Hildenbrand <david@...nel.org>, Christian Brauner <brauner@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Kemeng Shi <shikemeng@...weicloud.com>,
Guo Weikang <guoweikang.kernel@...il.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] mm: shmem: avoid build warning for CONFIG_SHMEM=n
On Thu, Dec 4, 2025 at 5:29 AM Arnd Bergmann <arnd@...nel.org> wrote:
>
> From: Arnd Bergmann <arnd@...db.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@...db.de>
> ---
> v2: make shmem_unacct_size() inline as well.
Reviewed-by: Pasha Tatashin <pasha.tatashin@...een.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
>
Powered by blists - more mailing lists