In damon_young_pmd_entry(), it calls pmd_trans_huge() to check whether
the OS supports THP, if CONFIG_TRANSPARENT_HUGEPAGE is not included,
the pmd_trans_huge() will return 0.
Signed-off-by: Xin Hao <[email protected]>
---
mm/damon/vaddr.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 58bf1bbad530..21daaa5503fb 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -434,7 +434,6 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr,
struct page *page;
struct damon_young_walk_private *priv = walk->private;
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (pmd_trans_huge(*pmd)) {
ptl = pmd_lock(walk->mm, pmd);
if (!pmd_present(*pmd)) {
@@ -462,7 +461,6 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr,
}
regular_page:
-#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
return -EINVAL;
--
2.31.0
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/[email protected]/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 <[email protected]>
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
https://01.org/lkp
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: mips-randconfig-r003-20220915
compiler: mips64-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://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=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash mm/damon/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
mm/damon/vaddr.c: In function 'damon_young_pmd_entry':
>> mm/damon/vaddr.c:451:21: error: implicit declaration of function 'pmd_young'; did you mean 'pte_young'? [-Werror=implicit-function-declaration]
451 | if (pmd_young(*pmd) || !page_is_idle(page) ||
| ^~~~~~~~~
| pte_young
cc1: some warnings being treated as errors
vim +451 mm/damon/vaddr.c
3f49584b262cf8 SeongJae Park 2021-09-07 428
3f49584b262cf8 SeongJae Park 2021-09-07 429 static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr,
3f49584b262cf8 SeongJae Park 2021-09-07 430 unsigned long next, struct mm_walk *walk)
3f49584b262cf8 SeongJae Park 2021-09-07 431 {
3f49584b262cf8 SeongJae Park 2021-09-07 432 pte_t *pte;
3f49584b262cf8 SeongJae Park 2021-09-07 433 spinlock_t *ptl;
3f49584b262cf8 SeongJae Park 2021-09-07 434 struct page *page;
3f49584b262cf8 SeongJae Park 2021-09-07 435 struct damon_young_walk_private *priv = walk->private;
3f49584b262cf8 SeongJae Park 2021-09-07 436
72c33ef4c02e32 Baolin Wang 2022-08-18 437 if (pmd_trans_huge(*pmd)) {
3f49584b262cf8 SeongJae Park 2021-09-07 438 ptl = pmd_lock(walk->mm, pmd);
c8b9aff419303e Baolin Wang 2022-08-18 439 if (!pmd_present(*pmd)) {
c8b9aff419303e Baolin Wang 2022-08-18 440 spin_unlock(ptl);
c8b9aff419303e Baolin Wang 2022-08-18 441 return 0;
c8b9aff419303e Baolin Wang 2022-08-18 442 }
c8b9aff419303e Baolin Wang 2022-08-18 443
72c33ef4c02e32 Baolin Wang 2022-08-18 444 if (!pmd_trans_huge(*pmd)) {
3f49584b262cf8 SeongJae Park 2021-09-07 445 spin_unlock(ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 446 goto regular_page;
3f49584b262cf8 SeongJae Park 2021-09-07 447 }
3f49584b262cf8 SeongJae Park 2021-09-07 448 page = damon_get_page(pmd_pfn(*pmd));
3f49584b262cf8 SeongJae Park 2021-09-07 449 if (!page)
3f49584b262cf8 SeongJae Park 2021-09-07 450 goto huge_out;
3f49584b262cf8 SeongJae Park 2021-09-07 @451 if (pmd_young(*pmd) || !page_is_idle(page) ||
3f49584b262cf8 SeongJae Park 2021-09-07 452 mmu_notifier_test_young(walk->mm,
3f49584b262cf8 SeongJae Park 2021-09-07 453 addr)) {
02e34fff195d3a Kefeng Wang 2022-05-17 454 *priv->page_sz = HPAGE_PMD_SIZE;
3f49584b262cf8 SeongJae Park 2021-09-07 455 priv->young = true;
3f49584b262cf8 SeongJae Park 2021-09-07 456 }
3f49584b262cf8 SeongJae Park 2021-09-07 457 put_page(page);
3f49584b262cf8 SeongJae Park 2021-09-07 458 huge_out:
3f49584b262cf8 SeongJae Park 2021-09-07 459 spin_unlock(ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 460 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 461 }
3f49584b262cf8 SeongJae Park 2021-09-07 462
3f49584b262cf8 SeongJae Park 2021-09-07 463 regular_page:
3f49584b262cf8 SeongJae Park 2021-09-07 464
3f49584b262cf8 SeongJae Park 2021-09-07 465 if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd)))
3f49584b262cf8 SeongJae Park 2021-09-07 466 return -EINVAL;
3f49584b262cf8 SeongJae Park 2021-09-07 467 pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 468 if (!pte_present(*pte))
3f49584b262cf8 SeongJae Park 2021-09-07 469 goto out;
3f49584b262cf8 SeongJae Park 2021-09-07 470 page = damon_get_page(pte_pfn(*pte));
3f49584b262cf8 SeongJae Park 2021-09-07 471 if (!page)
3f49584b262cf8 SeongJae Park 2021-09-07 472 goto out;
3f49584b262cf8 SeongJae Park 2021-09-07 473 if (pte_young(*pte) || !page_is_idle(page) ||
3f49584b262cf8 SeongJae Park 2021-09-07 474 mmu_notifier_test_young(walk->mm, addr)) {
3f49584b262cf8 SeongJae Park 2021-09-07 475 *priv->page_sz = PAGE_SIZE;
3f49584b262cf8 SeongJae Park 2021-09-07 476 priv->young = true;
3f49584b262cf8 SeongJae Park 2021-09-07 477 }
3f49584b262cf8 SeongJae Park 2021-09-07 478 put_page(page);
3f49584b262cf8 SeongJae Park 2021-09-07 479 out:
3f49584b262cf8 SeongJae Park 2021-09-07 480 pte_unmap_unlock(pte, ptl);
3f49584b262cf8 SeongJae Park 2021-09-07 481 return 0;
3f49584b262cf8 SeongJae Park 2021-09-07 482 }
3f49584b262cf8 SeongJae Park 2021-09-07 483
--
0-DAY CI Kernel Test Service
https://01.org/lkp
On Fri, 16 Sep 2022 05:54:56 +0800 kernel test robot <[email protected]> wrote:
> 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/[email protected]/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 <[email protected]>
>
> 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)
> ^
Thanks. I guess the arch needn't implement pmd_young() if it doesn't
implement THP.
I dropped the patch.
在 2022/9/16 上午6:26, Andrew Morton 写道:
> On Fri, 16 Sep 2022 05:54:56 +0800 kernel test robot <[email protected]> wrote:
>
>> 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/[email protected]/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 <[email protected]>
>>
>> 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)
>> ^
> Thanks. I guess the arch needn't implement pmd_young() if it doesn't
> implement THP.
>
> I dropped the patch.
Oh, my bad, thanks.