Re: [PATCH 1/3] mm/mmap: fix various coding style warnings
From: Zi Yan
Date: Sat Sep 05 2026 - 12:19:38 EST
On Sat Sep 5, 2026 at 10:01 AM EDT, Christos Skarlos wrote:
> Resolve coding style warnings and errors flagged by checkpatch.pl script. Specifically:
> - Remove the obsolete filename reference in the top comment.
> - Replace <asm/cacheflush.h> and <asm/mmu_context.h> with <linux/...>.
> - Add missing blank lines after variable declarations and replace spaces with tabs where needed.
>
> No functional changes are introduced.
>
> Signed-off-by: Christos Skarlos <christosskarlos.kernel@xxxxxxxxx>
> ---
> mm/mmap.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 4bf26b0f1e6e..626d3d2493ae 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1,6 +1,5 @@
> // SPDX-License-Identifier: GPL-2.0-only
> /*
> - * mm/mmap.c
Why?
> *
> * Written by obz.
> *
> @@ -50,9 +49,9 @@
> #include <linux/memfd.h>
>
> #include <linux/uaccess.h>
> -#include <asm/cacheflush.h>
> +#include <linux/cacheflush.h>
> #include <asm/tlb.h>
> -#include <asm/mmu_context.h>
> +#include <linux/mmu_context.h>
mmap.c does not use any functions in linux versions, why replace asm
versions with them? checkpatch.pl has no check for these.
<snip>
> @@ -942,6 +942,7 @@ find_vma_prev(struct mm_struct *mm, unsigned long addr,
> struct vm_area_struct **pprev)
> {
> struct vm_area_struct *vma;
> +
> VMA_ITERATOR(vmi, mm, addr);
Have you checked the definition of VMA_ITERATOR? It declares struct
vma_iterator.
>
> vma = vma_iter_load(&vmi);
> @@ -1017,12 +1018,12 @@ struct vm_area_struct *find_extend_vma_locked(struct mm_struct *mm, unsigned lon
>
> #if defined(CONFIG_STACK_GROWSUP)
>
> -#define vma_expand_up(vma,addr) expand_upwards(vma, addr)
> +#define vma_expand_up(vma, addr) expand_upwards(vma, addr)
> #define vma_expand_down(vma, addr) (-EFAULT)
>
> #else
>
> -#define vma_expand_up(vma,addr) (-EFAULT)
> +#define vma_expand_up(vma, addr) (-EFAULT)
> #define vma_expand_down(vma, addr) expand_downwards(vma, addr)
>
> #endif
> @@ -1227,6 +1228,7 @@ int vm_brk_flags(unsigned long addr, unsigned long request, bool is_exec)
> int ret;
> bool populate;
> LIST_HEAD(uf);
> +
> VMA_ITERATOR(vmi, mm, addr);
Ditto.
>
> len = PAGE_ALIGN(request);
> @@ -1290,6 +1292,7 @@ void exit_mmap(struct mm_struct *mm)
> struct mmu_gather tlb;
> struct vm_area_struct *vma;
> unsigned long nr_accounted = 0;
> +
> VMA_ITERATOR(vmi, mm, 0);
> struct unmap_desc unmap;
Ditto.
>
> @@ -1454,6 +1457,7 @@ static vm_fault_t special_mapping_fault(struct vm_fault *vmf)
>
> if (*pages) {
> struct page *page = *pages;
> +
> get_page(page);
> vmf->page = page;
> return 0;
> @@ -1711,6 +1715,7 @@ __latent_entropy int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
> int retval;
> unsigned long charge = 0;
> LIST_HEAD(uf);
> +
> VMA_ITERATOR(vmi, mm, 0);
Ditto.
>
> if (mmap_write_lock_killable(oldmm))
--
Best Regards,
Yan, Zi