From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CE75281504 for ; Thu, 4 Dec 2025 10:02:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764842554; cv=none; b=hk68s+QqBk1vlGxcA9mwW8FiFQNUsRdzn/a8HBKysxDP9XmjXF1fg9WgyPjyRzYFvglxHwrJp3E+Thkk+mBGRZ4c9tFSMqcrCFVK58u27fJKnW/ZID1VNHSanIC9XaTLmfyqjKh1P1zt1O2RdZASdIrPRA/c0321u0orxIbtLRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764842554; c=relaxed/simple; bh=APMg9IMKLDeVUcBosODe5rgOnSNLvIaubmEmIh251lU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ZJun5O0mVglhyPJaWusgM55UuP1jkmyc/DuUmEFXB3ypjZTRRFw0CSJD82bYZiV/JMmvl4Ot5ZRI+62kamwVKSw8/5l52TpPusfPrTqpL+e4L6LFU/rOv1ntIclpXmfa5cG1OUVjfCtNwO6A/DiwpRnnAZBuoXbN1ICRakTtCjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HQAH8YeD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HQAH8YeD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6BADC4CEFB; Thu, 4 Dec 2025 10:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764842553; bh=APMg9IMKLDeVUcBosODe5rgOnSNLvIaubmEmIh251lU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HQAH8YeDgnuexMhj6l5uqKOJvu/4J6NCdoeY0XaBN+hfIqRxU3UMV3Ka6ia4rN3tT 3AZmMvzr5d42MP5lRabrfeJqB9HbEuOWLLtgvYXGbnv06dAJVbWBje9GyQwtTESc/U UGpp8765MD81nAqO5cSiCUESSAfDjBmmoqpl9kNTo4cxakmQef/Vd1ejTOCPkzMus+ U8u6/5QsnZXnTjPyCn3W9LH9aXm7kqcEMBzvC2VhEIJYnh1BHf+0i0XYmQibUkuxln t/lnOJBQcFn8QDX+Tf/6UHwVvTCKwJxtPCvf38xn6uXhwcrZTzX2VMglk4qqsqgxcd GIS4V6Fid3okg== From: Pratyush Yadav To: Arnd Bergmann Cc: Hugh Dickins , Andrew Morton , "Mike Rapoport (Microsoft)" , Pasha Tatashin , Pratyush Yadav , Arnd Bergmann , Baolin Wang , Kairui Song , David Hildenbrand , Christian Brauner , Kemeng Shi , Lorenzo Stoakes , Guo Weikang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: shmem: avoid build warning for CONFIG_SHMEM=n In-Reply-To: <20251204094444.1030143-1-arnd@kernel.org> (Arnd Bergmann's message of "Thu, 4 Dec 2025 10:44:40 +0100") References: <20251204094444.1030143-1-arnd@kernel.org> Date: Thu, 04 Dec 2025 11:02:27 +0100 Message-ID: <861plamuoc.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Hi Arnd, On Thu, Dec 04 2025, Arnd Bergmann wrote: > From: Arnd Bergmann > > 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 macro with an equivalent inline function to get the > argument checking. > > Fixes: 6ff1610ced56 ("mm: shmem: use SHMEM_F_* flags instead of VM_* flags") > Signed-off-by: Arnd Bergmann Thanks for the fix! I recall that the kernel test robot also reported something similar, and Andrew sent out a fix for that [0]. But I guess it got dropped in the later re-rolls of the patchset. > --- > mm/shmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index 3f194c9842a8..93746270c459 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -5794,7 +5794,7 @@ 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 > +static inline int shmem_acct_size(unsigned long flags, loff_t size) { return 0; } > #define shmem_unacct_size(flags, size) do {} while (0) Can you please also make shmem_unacct_size() an inline function for consistency? > > static inline struct inode *shmem_get_inode(struct mnt_idmap *idmap, [0] https://lore.kernel.org/all/20251108084308.8640699dc4f737c520841391@linux-foundation.org/ -- Regards, Pratyush Yadav