[rt-devel:linux-5.15.y-rt-rebase 95/160] mm/vmalloc.c:1884:24: error: variable 'cpu' set but not used

From: kernel test robot
Date: Sun Oct 31 2021 - 01:25:18 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.15.y-rt-rebase
head: 72f25aab248815ab9e3b9dd088d3c8b3e93fb6d6
commit: 045e9ea1f791ae6c4c54495c7c6b86ed86f702d7 [95/160] mm/vmalloc: Another preempt disable region which sucks
config: arm-buildonly-randconfig-r005-20211031 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/commit/?id=045e9ea1f791ae6c4c54495c7c6b86ed86f702d7
git remote add rt-devel https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git
git fetch --no-tags rt-devel linux-5.15.y-rt-rebase
git checkout 045e9ea1f791ae6c4c54495c7c6b86ed86f702d7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

mm/vmalloc.c: In function 'new_vmap_block':
>> mm/vmalloc.c:1884:24: error: variable 'cpu' set but not used [-Werror=unused-but-set-variable]
1884 | int node, err, cpu;
| ^~~
mm/vmalloc.c: In function 'vb_alloc':
mm/vmalloc.c:1991:13: error: variable 'cpu' set but not used [-Werror=unused-but-set-variable]
1991 | int cpu;
| ^~~
cc1: all warnings being treated as errors


vim +/cpu +1884 mm/vmalloc.c

1869
1870 /**
1871 * new_vmap_block - allocates new vmap_block and occupies 2^order pages in this
1872 * block. Of course pages number can't exceed VMAP_BBMAP_BITS
1873 * @order: how many 2^order pages should be occupied in newly allocated block
1874 * @gfp_mask: flags for the page level allocator
1875 *
1876 * Return: virtual address in a newly allocated block or ERR_PTR(-errno)
1877 */
1878 static void *new_vmap_block(unsigned int order, gfp_t gfp_mask)
1879 {
1880 struct vmap_block_queue *vbq;
1881 struct vmap_block *vb;
1882 struct vmap_area *va;
1883 unsigned long vb_idx;
> 1884 int node, err, cpu;
1885 void *vaddr;
1886
1887 node = numa_node_id();
1888
1889 vb = kmalloc_node(sizeof(struct vmap_block),
1890 gfp_mask & GFP_RECLAIM_MASK, node);
1891 if (unlikely(!vb))
1892 return ERR_PTR(-ENOMEM);
1893
1894 va = alloc_vmap_area(VMAP_BLOCK_SIZE, VMAP_BLOCK_SIZE,
1895 VMALLOC_START, VMALLOC_END,
1896 node, gfp_mask);
1897 if (IS_ERR(va)) {
1898 kfree(vb);
1899 return ERR_CAST(va);
1900 }
1901
1902 vaddr = vmap_block_vaddr(va->va_start, 0);
1903 spin_lock_init(&vb->lock);
1904 vb->va = va;
1905 /* At least something should be left free */
1906 BUG_ON(VMAP_BBMAP_BITS <= (1UL << order));
1907 vb->free = VMAP_BBMAP_BITS - (1UL << order);
1908 vb->dirty = 0;
1909 vb->dirty_min = VMAP_BBMAP_BITS;
1910 vb->dirty_max = 0;
1911 INIT_LIST_HEAD(&vb->free_list);
1912
1913 vb_idx = addr_to_vb_idx(va->va_start);
1914 err = xa_insert(&vmap_blocks, vb_idx, vb, gfp_mask);
1915 if (err) {
1916 kfree(vb);
1917 free_vmap_area(va);
1918 return ERR_PTR(err);
1919 }
1920
1921 cpu = get_cpu_light();
1922 vbq = this_cpu_ptr(&vmap_block_queue);
1923 spin_lock(&vbq->lock);
1924 list_add_tail_rcu(&vb->free_list, &vbq->free);
1925 spin_unlock(&vbq->lock);
1926 put_cpu_light();
1927
1928 return vaddr;
1929 }
1930

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip