[rt-devel:linux-5.15.y-rt-rebase 65/142] mm/vmalloc.c:1884:17: warning: variable 'cpu' set but not used

From: kernel test robot
Date: Wed Sep 29 2021 - 13:54:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.15.y-rt-rebase
head: c567287ddde8bc8a15f71e60ffe344afdfd13476
commit: 641d2bf18d8e564204ddf2a24eb78fc380de8859 [65/142] mm/vmalloc: Another preempt disable region which sucks
config: hexagon-randconfig-r045-20210929 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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=641d2bf18d8e564204ddf2a24eb78fc380de8859
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 641d2bf18d8e564204ddf2a24eb78fc380de8859
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=hexagon

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

All warnings (new ones prefixed by >>):

>> mm/vmalloc.c:1884:17: warning: variable 'cpu' set but not used [-Wunused-but-set-variable]
int node, err, cpu;
^
mm/vmalloc.c:1991:6: warning: variable 'cpu' set but not used [-Wunused-but-set-variable]
int cpu;
^
mm/vmalloc.c:781:1: warning: unused function 'compute_subtree_max_size' [-Wunused-function]
compute_subtree_max_size(struct vmap_area *va)
^
3 warnings generated.


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