Re: [PATCH V1 2/2] mm/damon/core: remove duplicate check about THP

kernel test robot
2022-09-15T21:56:00Z

Hi Xin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on akpm-mm/mm-everything]

url: https://github.com/intel-lab-lkp/linux/commits/Xin-Hao/mm-damon-sysfs-avoid-call-damon_target_has_pid-repeatedly/20220915-230635
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
config: hexagon-randconfig-r002-20220915 (https://download.01.org/0day-ci/archive/20220916/202209160528.6z2rUbjZ-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920)
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://github.com/intel-lab-lkp/linux/commit/7902790b04d0eb74686b55218e8ead191ba5c003
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Xin-Hao/mm-damon-sysfs-avoid-call-damon_target_has_pid-repeatedly/20220915-230635
git checkout 7902790b04d0eb74686b55218e8ead191ba5c003
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash mm/damon/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> mm/damon/vaddr.c:451:7: error: call to undeclared function 'pmd_young'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (pmd_young(*pmd) || !page_is_idle(page) ||
^
mm/damon/vaddr.c:451:7: note: did you mean 'pte_young'?
arch/hexagon/include/asm/pgtable.h:273:19: note: 'pte_young' declared here
static inline int pte_young(pte_t pte)
^
1 error generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for PROC_CHILDREN
Depends on [n]: PROC_FS [=n]
Selected by [y]:
- CHECKPOINT_RESTORE [=y]

vim +/pmd_young +451 mm/damon/vaddr.c

3f49584b262cf8f SeongJae Park 2021-09-07 428
3f49584b262cf8f SeongJae Park 2021-09-07 429 static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr,
3f49584b262cf8f SeongJae Park 2021-09-07 430 unsigned long next, struct mm_walk *walk)
3f49584b262cf8f SeongJae Park 2021-09-07 431 {
3f49584b262cf8f SeongJae Park 2021-09-07 432 pte_t *pte;
3f49584b262cf8f SeongJae Park 2021-09-07 433 spinlock_t *ptl;
3f49584b262cf8f SeongJae Park 2021-09-07 434 struct page *page;
3f49584b262cf8f SeongJae Park 2021-09-07 435 struct damon_young_walk_private *priv = walk->private;
3f49584b262cf8f SeongJae Park 2021-09-07 436
72c33ef4c02e32e Baolin Wang 2022-08-18 437 if (pmd_trans_huge(*pmd)) {
3f49584b262cf8f SeongJae Park 2021-09-07 438 ptl = pmd_lock(walk->mm, pmd);
c8b9aff419303e4 Baolin Wang 2022-08-18 439 if (!pmd_present(*pmd)) {
c8b9aff419303e4 Baolin Wang 2022-08-18 440 spin_unlock(ptl);
c8b9aff419303e4 Baolin Wang 2022-08-18 441 return 0;
c8b9aff419303e4 Baolin Wang 2022-08-18 442 }
c8b9aff419303e4 Baolin Wang 2022-08-18 443
72c33ef4c02e32e Baolin Wang 2022-08-18 444 if (!pmd_trans_huge(*pmd)) {
3f49584b262cf8f SeongJae Park 2021-09-07 445 spin_unlock(ptl);
3f49584b262cf8f SeongJae Park 2021-09-07 446 goto regular_page;
3f49584b262cf8f SeongJae Park 2021-09-07 447 }
3f49584b262cf8f SeongJae Park 2021-09-07 448 page = damon_get_page(pmd_pfn(*pmd));
3f49584b262cf8f SeongJae Park 2021-09-07 449 if (!page)
3f49584b262cf8f SeongJae Park 2021-09-07 450 goto huge_out;
3f49584b262cf8f SeongJae Park 2021-09-07 @451 if (pmd_young(*pmd) || !page_is_idle(page) ||
3f49584b262cf8f SeongJae Park 2021-09-07 452 mmu_notifier_test_young(walk->mm,
3f49584b262cf8f SeongJae Park 2021-09-07 453 addr)) {
02e34fff195d3a5 Kefeng Wang 2022-05-17 454 *priv->page_sz = HPAGE_PMD_SIZE;
3f49584b262cf8f SeongJae Park 2021-09-07 455 priv->young = true;
3f49584b262cf8f SeongJae Park 2021-09-07 456 }
3f49584b262cf8f SeongJae Park 2021-09-07 457 put_page(page);
3f49584b262cf8f SeongJae Park 2021-09-07 458 huge_out:
3f49584b262cf8f SeongJae Park 2021-09-07 459 spin_unlock(ptl);
3f49584b262cf8f SeongJae Park 2021-09-07 460 return 0;
3f49584b262cf8f SeongJae Park 2021-09-07 461 }
3f49584b262cf8f SeongJae Park 2021-09-07 462
3f49584b262cf8f SeongJae Park 2021-09-07 463 regular_page:
3f49584b262cf8f SeongJae Park 2021-09-07 464
3f49584b262cf8f SeongJae Park 2021-09-07 465 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
3f49584b262cf8f SeongJae Park 2021-09-07 466 return -EINVAL;
3f49584b262cf8f SeongJae Park 2021-09-07 467 pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
3f49584b262cf8f SeongJae Park 2021-09-07 468 if (!pte_present(*pte))
3f49584b262cf8f SeongJae Park 2021-09-07 469 goto out;
3f49584b262cf8f SeongJae Park 2021-09-07 470 page = damon_get_page(pte_pfn(*pte));
3f49584b262cf8f SeongJae Park 2021-09-07 471 if (!page)
3f49584b262cf8f SeongJae Park 2021-09-07 472 goto out;
3f49584b262cf8f SeongJae Park 2021-09-07 473 if (pte_young(*pte) || !page_is_idle(page) ||
3f49584b262cf8f SeongJae Park 2021-09-07 474 mmu_notifier_test_young(walk->mm, addr)) {
3f49584b262cf8f SeongJae Park 2021-09-07 475 *priv->page_sz = PAGE_SIZE;
3f49584b262cf8f SeongJae Park 2021-09-07 476 priv->young = true;
3f49584b262cf8f SeongJae Park 2021-09-07 477 }
3f49584b262cf8f SeongJae Park 2021-09-07 478 put_page(page);
3f49584b262cf8f SeongJae Park 2021-09-07 479 out:
3f49584b262cf8f SeongJae Park 2021-09-07 480 pte_unmap_unlock(pte, ptl);
3f49584b262cf8f SeongJae Park 2021-09-07 481 return 0;
3f49584b262cf8f SeongJae Park 2021-09-07 482 }
3f49584b262cf8f SeongJae Park 2021-09-07 483

--
0-DAY CI Kernel Test Service