[linux-stable-rc:linux-5.4.y 3113/4278] mm/mempolicy.c:499:22: warning: variable 'mapped_pte' set but not used
From: kernel test robot
Date: Tue Sep 14 2021 - 19:44:39 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head: f52a40401ee9825556cc803c110c67bfec5f6b94
commit: c1f729c7dec0df04d62550d981af849f970a660d [3113/4278] mm: mempolicy: fix potential pte_unmap_unlock pte error
config: ia64-randconfig-r036-20210914 (attached as .config)
compiler: ia64-linux-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/stable/linux-stable-rc.git/commit/?id=c1f729c7dec0df04d62550d981af849f970a660d
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-5.4.y
git checkout c1f729c7dec0df04d62550d981af849f970a660d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
In file included from arch/ia64/include/asm/pgtable.h:154,
from include/linux/mm.h:99,
from include/linux/dax.h:6,
from include/linux/mempolicy.h:11,
from mm/mempolicy.c:70:
arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
arch/ia64/include/asm/mmu_context.h:137:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
137 | unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
| ^~~~~~~
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, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip