Skip to contentSkip to conversation

mm-constify-shmem-related-test-functions-for-improved-const-correctness.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Sep 21, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm: constify shmem related test functions for improved const-correctness
has been removed from the -mm tree. Its filename was
mm-constify-shmem-related-test-functions-for-improved-const-correctness.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Max Kellermann <[email protected]>
Subject: mm: constify shmem related test functions for improved const-correctness
Date: Mon, 1 Sep 2025 22:50:10 +0200

Patch series "mm: establish const-correctness for pointer parameters", v6.

This series is to improved const-correctness in the low-level memory-management subsystem, which provides a basis for further constification further up the call stack (e.g. filesystems).

I started this work when I tried to constify the Ceph filesystem code, but found that to be impossible because many "mm" functions accept non-const pointers, even though they modify nothing.

This patch (of 12):

We select certain test functions which either invoke each other, functions that are already const-ified, or no further functions.

It is therefore relatively trivial to const-ify them, which provides a basis for further const-ification further up the call stack.

Cc Alexander Gordeev <[email protected]>
Cc Al Viro <[email protected]>
Cc Andreas Larsson <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Axel Rasmussen <[email protected]>
Cc Baolin Wang <[email protected]>
Cc Borislav Betkov <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Christian Brauner <[email protected]>
Cc Christian Zankel <[email protected]>
Cc David Rientjes <[email protected]>
Cc David S. Miller <[email protected]>
Cc Gerald Schaefer <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Helge Deller <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc James Bottomley <[email protected]>
Cc Jan Kara <[email protected]>
Cc Jocelyn Falempe <[email protected]>
Cc Liam Howlett <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Max Filippov <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Michal Hocko <[email protected]>
Cc "Nysal Jan K.A" <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Russel King <[email protected]>
Cc Suren Baghdasaryan <[email protected]>
Cc Sven Schnelle <[email protected]>
Cc Thomas Gleinxer <[email protected]>
Cc Thomas Huth <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Wei Xu <[email protected]>
Cc Yuanchu Xie <[email protected]>

---

 include/linux/mm.h       |    8 ++++----
 include/linux/shmem_fs.h |    4 ++--
 mm/shmem.c               |    6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-constify-shmem-related-test-functions-for-improved-const-correctness +4 -4
@@ -995,11 +995,11 @@ static inline void vma_iter_set(struct v
  * The vma_is_shmem is not inline because it is used only by slow
  * paths in userfault.
  */
-bool vma_is_shmem(struct vm_area_struct *vma);
-bool vma_is_anon_shmem(struct vm_area_struct *vma);
+bool vma_is_shmem(const struct vm_area_struct *vma);
+bool vma_is_anon_shmem(const struct vm_area_struct *vma);
 #else
-static inline bool vma_is_shmem(struct vm_area_struct *vma) { return false; }
-static inline bool vma_is_anon_shmem(struct vm_area_struct *vma) { return false; }
+static inline bool vma_is_shmem(const struct vm_area_struct *vma) { return false; }
+static inline bool vma_is_anon_shmem(const struct vm_area_struct *vma) { return false; }
 #endif
 
 int vma_is_stack_for_current(struct vm_area_struct *vma);
include/linux/shmem_fs.h renamed from include/linux/shmem_fs.h~mm-constify-shmem-related-test-functions-for-improved-const-correctness +2 -2
@@ -99,9 +99,9 @@ extern unsigned long shmem_get_unmapped_
 		unsigned long len, unsigned long pgoff, unsigned long flags);
 extern int shmem_lock(struct file *file, int lock, struct ucounts *ucounts);
 #ifdef CONFIG_SHMEM
-bool shmem_mapping(struct address_space *mapping);
+bool shmem_mapping(const struct address_space *mapping);
 #else
-static inline bool shmem_mapping(struct address_space *mapping)
+static inline bool shmem_mapping(const struct address_space *mapping)
 {
 	return false;
 }
mm/shmem.c renamed from mm/shmem.c~mm-constify-shmem-related-test-functions-for-improved-const-correctness +3 -3
@@ -275,18 +275,18 @@ static const struct vm_operations_struct
 static const struct vm_operations_struct shmem_anon_vm_ops;
 static struct file_system_type shmem_fs_type;
 
-bool shmem_mapping(struct address_space *mapping)
+bool shmem_mapping(const struct address_space *mapping)
 {
 	return mapping->a_ops == &shmem_aops;
 }
 EXPORT_SYMBOL_GPL(shmem_mapping);
 
-bool vma_is_anon_shmem(struct vm_area_struct *vma)
+bool vma_is_anon_shmem(const struct vm_area_struct *vma)
 {
 	return vma->vm_ops == &shmem_anon_vm_ops;
 }
 
-bool vma_is_shmem(struct vm_area_struct *vma)
+bool vma_is_shmem(const struct vm_area_struct *vma)
 {
 	return vma_is_anon_shmem(vma) || vma->vm_ops == &shmem_vm_ops;
 }

_

Patches currently in -mm which might be from [email protected] are