* [PATCH] smaps: Fix defined but not used smaps_shmem_walk_ops
@ 2023-04-03 11:12 Steven Price
2023-04-03 14:52 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Steven Price @ 2023-04-03 11:12 UTC (permalink / raw)
To: Andrew Morton
Cc: Steven Price, linux-fsdevel, linux-kernel, Jason Gunthorpe,
Thomas Hellstrom, Christoph Hellwig, kernel test robot
When !CONFIG_SHMEM smaps_shmem_walk_ops is defined but not used,
triggering a compiler warning. Surround the definition with an #ifdef to
keep the compiler happy.
Fixes: 7b86ac3371b7 ("pagewalk: separate function pointers from iterator data")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202304031749.UiyJpxzF-lkp@intel.com/
Signed-off-by: Steven Price <steven.price@arm.com>
---
fs/proc/task_mmu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 6a96e1713fd5..3d4f8859dac1 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -761,11 +761,13 @@ static const struct mm_walk_ops smaps_walk_ops = {
.hugetlb_entry = smaps_hugetlb_range,
};
+#ifdef CONFIG_SHMEM
static const struct mm_walk_ops smaps_shmem_walk_ops = {
.pmd_entry = smaps_pte_range,
.hugetlb_entry = smaps_hugetlb_range,
.pte_hole = smaps_pte_hole,
};
+#endif
/*
* Gather mem stats from @vma with the indicated beginning
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] smaps: Fix defined but not used smaps_shmem_walk_ops
2023-04-03 11:12 [PATCH] smaps: Fix defined but not used smaps_shmem_walk_ops Steven Price
@ 2023-04-03 14:52 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2023-04-03 14:52 UTC (permalink / raw)
To: Steven Price
Cc: Andrew Morton, linux-fsdevel, linux-kernel, Thomas Hellstrom,
Christoph Hellwig, kernel test robot
On Mon, Apr 03, 2023 at 12:12:55PM +0100, Steven Price wrote:
> When !CONFIG_SHMEM smaps_shmem_walk_ops is defined but not used,
> triggering a compiler warning. Surround the definition with an #ifdef to
> keep the compiler happy.
>
> Fixes: 7b86ac3371b7 ("pagewalk: separate function pointers from iterator data")
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202304031749.UiyJpxzF-lkp@intel.com/
> Signed-off-by: Steven Price <steven.price@arm.com>
> ---
> fs/proc/task_mmu.c | 2 ++
> 1 file changed, 2 insertions(+)
I think it would be better to enclose the definition of
shmem_swap_usage() in its header with a stub like shmem_mapping and
remove the ifdef completely. shmem_mapping() is already compile time
false.
#ifdef CONFIG_SHMEM
if (vma->vm_file && shmem_mapping(vma->vm_file->f_mapping)) {
/*
* For shared or readonly shmem mappings we know that all
* swapped out pages belong to the shmem object, and we can
* obtain the swap value much more efficiently. For private
* writable mappings, we might have COW pages that are
* not affected by the parent swapped out pages of the shmem
* object, so we have to distinguish them during the page walk.
* Unless we know that the shmem object (or the part mapped by
* our VMA) has no swapped out pages at all.
*/
unsigned long shmem_swapped = shmem_swap_usage(vma);
if (!start && (!shmem_swapped || (vma->vm_flags & VM_SHARED) ||
!(vma->vm_flags & VM_WRITE))) {
mss->swap += shmem_swapped;
} else {
ops = &smaps_shmem_walk_ops;
}
}
#endif
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-03 14:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-03 11:12 [PATCH] smaps: Fix defined but not used smaps_shmem_walk_ops Steven Price
2023-04-03 14:52 ` Jason Gunthorpe
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).