For improved const-correctness.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
include/linux/mm.h | 8 ++++----
include/linux/shmem_fs.h | 4 ++--
mm/shmem.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index cd14298bb958..18deb14cb1f5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -979,11 +979,11 @@ static inline void vma_iter_set(struct vma_iterator *vmi, unsigned long addr)
* 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);
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 6d0f9c599ff7..0e47465ef0fd 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -99,9 +99,9 @@ extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr,
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;
}
diff --git a/mm/shmem.c b/mm/shmem.c
index 640fecc42f60..d55bceaa1c80 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -275,18 +275,18 @@ static const struct vm_operations_struct shmem_vm_ops;
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 *const 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 *const 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 *const vma)
{
return vma_is_anon_shmem(vma) || vma->vm_ops == &shmem_vm_ops;
}
--
2.47.2
On Mon, Sep 01, 2025 at 08:12:12AM +0200, Max Kellermann wrote: > For improved const-correctness. This is not an acceptable commit message, you need to explain what you're doing here. I'm thinking that review will be the same for each... For instance, reference the fact you're starting with functions at the bottom of the call graph, and mention which functions you're changing. > > Signed-off-by: Max Kellermann <max.kellermann@ionos.com> > Reviewed-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> This otherwise, functionally, LGTM so: Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> On basis of you fixing the commit message. > --- > include/linux/mm.h | 8 ++++---- > include/linux/shmem_fs.h | 4 ++-- > mm/shmem.c | 6 +++--- > 3 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index cd14298bb958..18deb14cb1f5 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -979,11 +979,11 @@ static inline void vma_iter_set(struct vma_iterator *vmi, unsigned long addr) > * 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); > diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h > index 6d0f9c599ff7..0e47465ef0fd 100644 > --- a/include/linux/shmem_fs.h > +++ b/include/linux/shmem_fs.h > @@ -99,9 +99,9 @@ extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr, > 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; > } > diff --git a/mm/shmem.c b/mm/shmem.c > index 640fecc42f60..d55bceaa1c80 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -275,18 +275,18 @@ static const struct vm_operations_struct shmem_vm_ops; > 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 *const 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 *const 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 *const vma) > { > return vma_is_anon_shmem(vma) || vma->vm_ops == &shmem_vm_ops; > } > -- > 2.47.2 >
On Mon, Sep 1, 2025 at 9:44 AM Lorenzo Stoakes <lorenzo.stoakes@oracle.com> wrote: > > On Mon, Sep 01, 2025 at 08:12:12AM +0200, Max Kellermann wrote: > > For improved const-correctness. > > This is not an acceptable commit message, you need to explain what you're doing > here. > > I'm thinking that review will be the same for each... > > For instance, reference the fact you're starting with functions at the bottom of > the call graph, My 00/12 already describes that adding "const" to mm addresses the lowest level so higher levels (outside the scope of this patch set) are able to constify their APIs. Other than that, there is exactly one dependency between the patches, and that is documented in the commit message of 06/12. The rest has no "bottom" or "top" that I could describe. All other patches are standalone. > and mention which functions you're changing. So you want to have a list of function names in the commit message? Maybe I'll write a Perl one-liner to extract that from the diff, but .... will that really be helpful? To me, it looks like noise in a patch set as trivial as this one.
On Mon, Sep 01, 2025 at 10:01:16AM +0200, Max Kellermann wrote: > On Mon, Sep 1, 2025 at 9:44 AM Lorenzo Stoakes > <lorenzo.stoakes@oracle.com> wrote: > > > > On Mon, Sep 01, 2025 at 08:12:12AM +0200, Max Kellermann wrote: > > > For improved const-correctness. > > > > This is not an acceptable commit message, you need to explain what you're doing > > here. > > > > I'm thinking that review will be the same for each... > > > > For instance, reference the fact you're starting with functions at the bottom of > > the call graph, > > My 00/12 already describes that adding "const" to mm addresses the > lowest level so higher levels (outside the scope of this patch set) > are able to constify their APIs. I actually found your cover letter lacking there also as reviewed. It is simply not acceptable in the kernel to have a commit message like this. If you want to argue, that's up to you, but your series won't be merged. So overall - we're fine with this kind of duplication even for a 'trivial' series. Describe why you're doing, it why these functions. Something like 'In efforts to const-ify poitner parameters where appropriate, we start by adjusting those which invoke no other function, with the intent of working our way up gradually. Here we address functions relating to shmem.' etc. As David said on the other thread, you'd use your energy more usefully simply doing what's asked of you. Review is a limited resource, please have some empathy for the human beings behind the screen :) > > Other than that, there is exactly one dependency between the patches, > and that is documented in the commit message of 06/12. The rest has no > "bottom" or "top" that I could describe. All other patches are > standalone. > > > and mention which functions you're changing. > > So you want to have a list of function names in the commit message? > Maybe I'll write a Perl one-liner to extract that from the diff, but > .... will that really be helpful? To me, it looks like noise in a > patch set as trivial as this one. By all means use a script to figure it out, but use full english sentences to describe intent and what you're doing. Thanks.
© 2016 - 2025 Red Hat, Inc.