Skip to contentSkip to conversation

mm/vmalloc.c:3590:23: warning: unused variable 'start'

PATCH kernel test robot 4 participants 4 messages Jun 29 – Jun 30

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   88cefc306c43b58d9bb65c9e96e284306710d961
commit: 80c453511b6ee1af0e4db83c3db0020215c4eaf0 [59/142] mm/vmalloc: map contiguous pages in batches for vmap() if possible
config: csky-allnoconfig (https://download.01.org/0day-ci/archive/20260629/[email protected]/config)
compiler: csky-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260629/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

mm/vmalloc.c: In function 'vmap_batched':

>> mm/vmalloc.c:3590:23: warning: unused variable 'start' [-Wunused-variable]
    3590 |         unsigned long start = addr, map_addr = addr;
         |                       ^~~~~

vim +/start +3590 mm/vmalloc.c

3584
3585 static int vmap_batched(unsigned long addr, unsigned long end,
3586 pgprot_t prot, struct page **pages)
3587 {
3588 unsigned int count = (end - addr) >> PAGE_SHIFT;
3589 unsigned int prev_shift = 0, idx = 0;

> 3590		unsigned long start = addr, map_addr = addr;

3591 int err;
3592
3593 err = kmsan_vmap_pages_range_noflush(addr, end, prot, pages,
3594 PAGE_SHIFT, GFP_KERNEL);
3595 if (err)
3596 goto out;
3597
3598 for (unsigned int i = 0; i < count; ) {
3599 unsigned int shift = PAGE_SHIFT +
3600 get_vmap_batch_order(pages, prot, count - i, i);
3601
3602 if (!i)
3603 prev_shift = shift;
3604
3605 if (shift != prev_shift) {
3606 err = vmap_pages_range_noflush_walk(map_addr, addr,
3607 prot, pages + idx, prev_shift);
3608 if (err)
3609 goto out;
3610 prev_shift = shift;
3611 map_addr = addr;
3612 idx = i;
3613 }
3614
3615 /*
3616 * Once small pages are encountered, the remaining pages
3617 * are likely small as well.
3618 */
3619 if (shift == PAGE_SHIFT)
3620 break;
3621
3622 addr += 1UL << shift;
3623 i += 1U << (shift - PAGE_SHIFT);
3624 }
3625
3626 /* Remaining */
3627 if (map_addr < end)
3628 err = vmap_pages_range_noflush_walk(map_addr, end,
3629 prot, pages + idx, prev_shift);
3630
3631 out:
3632 flush_cache_vmap(start, end);
3633 return err;
3634 }
3635

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

maintainer
#1 lore raw
Quoted 12 lines · On Mon, 29 Jun 2026 16:58:34 +0800 kernel test robot <[email protected]> wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   88cefc306c43b58d9bb65c9e96e284306710d961
commit: 80c453511b6ee1af0e4db83c3db0020215c4eaf0 [59/142] mm/vmalloc: map contiguous pages in batches for vmap() if possible
config: csky-allnoconfig (https://download.01.org/0day-ci/archive/20260629/[email protected]/config)
compiler: csky-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260629/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 6 lines

All warnings (new ones prefixed by >>):

mm/vmalloc.c: In function 'vmap_batched':

Quoted 1 line
Quoted 1 line

mm/vmalloc.c:3590:23: warning: unused variable 'start' [-Wunused-variable]

    3590 |         unsigned long start = addr, map_addr = addr;
         |                       ^~~~~

Sigh.

	unsigned long start = addr, map_addr = addr;
	...
	flush_cache_vmap(start, end);

See, this is our punishment for writing kernel code in CPP rather than in C.

I'll queue (and test) the below. It should be OK - arch/csky/abiv1/inc/abi/cacheflush.h directly includes asm/cache.h which declares cache_wbinv_all().

From: Andrew Morton <[email protected]>
Subject: csky: implement flush_cache_vmap() in C
Date: Mon Jun 29 05:07:51 PM PDT 2026

To avoid getting an unused-var warning from

	unsigned long start = something;
	...
	flush_cache_vmap(start, ...);
Cc Guo Ren <[email protected]>
Cc Andrew Donnellan <[email protected]>
Cc Anshuman Khandual <[email protected]>
Cc "Barry Song (Xiaomi)" <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Dev Jain <[email protected]>
Cc Leo Yan <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Uladzislau Rezki <[email protected]>
Cc Wen Jiang <[email protected]>
Cc Wen Jiang <[email protected]>
Cc Will Deacon <[email protected]>
Cc Xueyuan Chen <[email protected]>

---

 arch/csky/abiv1/inc/abi/cacheflush.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/csky/abiv1/inc/abi/cacheflush.h renamed from arch/csky/abiv1/inc/abi/cacheflush.h~csky-implement-flush_cache_vmap-in-c +6 -1
@@ -42,7 +42,12 @@ static inline void flush_anon_page(struc
  * Use cache_wbinv_all() here and need to be improved in future.
  */
 extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
-#define flush_cache_vmap(start, end)		cache_wbinv_all()
+
+static inline void flush_cache_vmap(unsigned long start, unsigned long end)
+{
+	cache_wbinv_all();
+}
+
 #define flush_cache_vmap_early(start, end)	do { } while (0)
 #define flush_cache_vunmap(start, end)		cache_wbinv_all()
 

_

maintainer Reviewed-by
#2 lore raw
Quoted 70 lines · Andrew Morton
Quoted 12 lines · On Mon, 29 Jun 2026 16:58:34 +0800 kernel test robot <[email protected]> wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   88cefc306c43b58d9bb65c9e96e284306710d961
commit: 80c453511b6ee1af0e4db83c3db0020215c4eaf0 [59/142] mm/vmalloc: map contiguous pages in batches for vmap() if possible
config: csky-allnoconfig (https://download.01.org/0day-ci/archive/20260629/[email protected]/config)
compiler: csky-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260629/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 6 lines

All warnings (new ones prefixed by >>):

mm/vmalloc.c: In function 'vmap_batched':

Quoted 1 line
Quoted 1 line

mm/vmalloc.c:3590:23: warning: unused variable 'start' [-Wunused-variable]

    3590 |         unsigned long start = addr, map_addr = addr;
         |                       ^~~~~

Sigh.

        unsigned long start = addr, map_addr = addr;
        ...
        flush_cache_vmap(start, end);

See, this is our punishment for writing kernel code in CPP rather than in C.

I'll queue (and test) the below. It should be OK - arch/csky/abiv1/inc/abi/cacheflush.h directly includes asm/cache.h which declares cache_wbinv_all().

From: Andrew Morton <[email protected]>
Subject: csky: implement flush_cache_vmap() in C
Date: Mon Jun 29 05:07:51 PM PDT 2026

To avoid getting an unused-var warning from

        unsigned long start = something;
        ...
        flush_cache_vmap(start, ...);
Cc Guo Ren <[email protected]>
Cc Andrew Donnellan <[email protected]>
Cc Anshuman Khandual <[email protected]>
Cc "Barry Song (Xiaomi)" <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Dev Jain <[email protected]>
Cc Leo Yan <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Uladzislau Rezki <[email protected]>
Cc Wen Jiang <[email protected]>
Cc Wen Jiang <[email protected]>
Cc Will Deacon <[email protected]>
Cc Xueyuan Chen <[email protected]>

---

 arch/csky/abiv1/inc/abi/cacheflush.h |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

arch/csky/abiv1/inc/abi/cacheflush.h static inline void flush_anon_page(struc · line 50

Quoted 10 lines
arch/csky/abiv1/inc/abi/cacheflush.h renamed from arch/csky/abiv1/inc/abi/cacheflush.h~csky-implement-flush_cache_vmap-in-c +6 -1
@@ -42,7 +42,12 @@ static inline void flush_anon_page(struc
  * Use cache_wbinv_all() here and need to be improved in future.
  */
 extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
-#define flush_cache_vmap(start, end)           cache_wbinv_all()
+
+static inline void flush_cache_vmap(unsigned long start, unsigned long end)
+{
+       cache_wbinv_all();
+}
+

Thx for the fixup.

Signature · 2 lines
Best Regards
 Guo Ren
Reviewed-by
#3 lore raw
In reply to Andrew Morton
Quoted 46 lines · Andrew Morton
Quoted 12 lines · On Mon, 29 Jun 2026 16:58:34 +0800 kernel test robot <[email protected]> wrote:
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   88cefc306c43b58d9bb65c9e96e284306710d961
commit: 80c453511b6ee1af0e4db83c3db0020215c4eaf0 [59/142] mm/vmalloc: map contiguous pages in batches for vmap() if possible
config: csky-allnoconfig (https://download.01.org/0day-ci/archive/20260629/[email protected]/config)
compiler: csky-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260629/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 6 lines

All warnings (new ones prefixed by >>):

mm/vmalloc.c: In function 'vmap_batched':

Quoted 1 line
Quoted 1 line

mm/vmalloc.c:3590:23: warning: unused variable 'start' [-Wunused-variable]

    3590 |         unsigned long start = addr, map_addr = addr;
         |                       ^~~~~

Sigh.

        unsigned long start = addr, map_addr = addr;
        ...
        flush_cache_vmap(start, end);

See, this is our punishment for writing kernel code in CPP rather than in C.

I'll queue (and test) the below. It should be OK - arch/csky/abiv1/inc/abi/cacheflush.h directly includes asm/cache.h which declares cache_wbinv_all().

From: Andrew Morton <[email protected]>
Subject: csky: implement flush_cache_vmap() in C
Date: Mon Jun 29 05:07:51 PM PDT 2026

To avoid getting an unused-var warning from

        unsigned long start = something;
        ...
        flush_cache_vmap(start, ...);
Quoted 16 lines
Cc Guo Ren <[email protected]>
Cc Andrew Donnellan <[email protected]>
Cc Anshuman Khandual <[email protected]>
Cc "Barry Song (Xiaomi)" <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Dev Jain <[email protected]>
Cc Leo Yan <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Uladzislau Rezki <[email protected]>
Cc Wen Jiang <[email protected]>
Cc Wen Jiang <[email protected]>
Cc Will Deacon <[email protected]>
Cc Xueyuan Chen <[email protected]>

Thanks for the fix. We even have a checkpatch check and coding style documentation for this:

6813216bbdba ("Documentation: coding-style: ask function-like macros to evaluate parameters")

b1be5844c1a ("scripts: checkpatch: check unused parameters for function-like macros")

Best Regards
Barry