[stable:linux-5.4.y 1353/9999] mm/mempolicy.c:499:22: warning: variable 'mapped_pte' set but not used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shijie,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.4.y
head:   ea7862c507eca54ea6caad9dcfc8bba5e749fbde
commit: c1f729c7dec0df04d62550d981af849f970a660d [1353/9999] mm: mempolicy: fix potential pte_unmap_unlock pte error
config: ia64-generic_defconfig (https://download.01.org/0day-ci/archive/20230514/202305140908.foLMWXHS-lkp@xxxxxxxxx/config)
compiler: ia64-linux-gcc (GCC) 12.1.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/stable/linux-stable.git/commit/?id=c1f729c7dec0df04d62550d981af849f970a660d
        git remote add stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
        git fetch --no-tags stable linux-5.4.y
        git checkout c1f729c7dec0df04d62550d981af849f970a660d
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202305140908.foLMWXHS-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   mm/mempolicy.c: In function 'queue_pages_pte_range':
>> mm/mempolicy.c:499:22: warning: variable 'mapped_pte' set but not used [-Wunused-but-set-variable]
     499 |         pte_t *pte, *mapped_pte;
         |                      ^~~~~~~~~~


vim +/mapped_pte +499 mm/mempolicy.c

   478	
   479	/*
   480	 * Scan through pages checking if pages follow certain conditions,
   481	 * and move them to the pagelist if they do.
   482	 *
   483	 * queue_pages_pte_range() has three possible return values:
   484	 * 0 - pages are placed on the right node or queued successfully.
   485	 * 1 - there is unmovable page, and MPOL_MF_MOVE* & MPOL_MF_STRICT were
   486	 *     specified.
   487	 * -EIO - only MPOL_MF_STRICT was specified and an existing page was already
   488	 *        on a node that does not follow the policy.
   489	 */
   490	static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr,
   491				unsigned long end, struct mm_walk *walk)
   492	{
   493		struct vm_area_struct *vma = walk->vma;
   494		struct page *page;
   495		struct queue_pages *qp = walk->private;
   496		unsigned long flags = qp->flags;
   497		int ret;
   498		bool has_unmovable = false;
 > 499		pte_t *pte, *mapped_pte;
   500		spinlock_t *ptl;
   501	
   502		ptl = pmd_trans_huge_lock(pmd, vma);
   503		if (ptl) {
   504			ret = queue_pages_pmd(pmd, ptl, addr, end, walk);
   505			if (ret != 2)
   506				return ret;
   507		}
   508		/* THP was split, fall through to pte walk */
   509	
   510		if (pmd_trans_unstable(pmd))
   511			return 0;
   512	
   513		mapped_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
   514		for (; addr != end; pte++, addr += PAGE_SIZE) {
   515			if (!pte_present(*pte))
   516				continue;
   517			page = vm_normal_page(vma, addr, *pte);
   518			if (!page)
   519				continue;
   520			/*
   521			 * vm_normal_page() filters out zero pages, but there might
   522			 * still be PageReserved pages to skip, perhaps in a VDSO.
   523			 */
   524			if (PageReserved(page))
   525				continue;
   526			if (!queue_pages_required(page, qp))
   527				continue;
   528			if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {
   529				/* MPOL_MF_STRICT must be specified if we get here */
   530				if (!vma_migratable(vma)) {
   531					has_unmovable = true;
   532					break;
   533				}
   534	
   535				/*
   536				 * Do not abort immediately since there may be
   537				 * temporary off LRU pages in the range.  Still
   538				 * need migrate other LRU pages.
   539				 */
   540				if (migrate_page_add(page, qp->pagelist, flags))
   541					has_unmovable = true;
   542			} else
   543				break;
   544		}
   545		pte_unmap_unlock(mapped_pte, ptl);
   546		cond_resched();
   547	
   548		if (has_unmovable)
   549			return 1;
   550	
   551		return addr != end ? -EIO : 0;
   552	}
   553	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux