fs/aio.c | 1 + include/linux/mempolicy.h | 1 - mm/mempolicy.c | 1 + 3 files changed, 2 insertions(+), 1 deletion(-)
Originally, linux/mempolicy.h included linux/pagemap.h because vma_migratable()
was implemented inline within the header(linux/mempolicy.h), requiring
mapping_gfp_mask() function from pagemap.h to implement vma_migratable().
Now that vma_migratable() is only declared in linux/mempolicy.h and its
implementation has been moved to mempolicy.c, the inclusion of linux/pagemap.h
in the header is no longer necessary.
So the linux/pagemap.h in linux/mempolicy.h need to be remove. Since we
used the function of pagemap.h in mempolicy.c, we need to include
linux/pagemap.h in mempolicy.c.
It appears that the modifications have been completed, but there may be
compilation errors during testing.
kunit UM build errors as below:
$ ./tools/testing/kunit/kunit.py run --kunitconfig ./mm/damon/tests/
[...]
fs/aio.c:525:71: error: ‘FGP_CREAT’ undeclared (first use in this function); did you mean ‘IPC_CREAT’?
525 | FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
| ^~~~~~~~~
| IPC_CREAT
fs/aio.c:532:17: error: implicit declaration of function ‘folio_end_read’; did you mean ‘folio_test_head’? [-Werror=implicit-function-declaration]
532 | folio_end_read(folio, true);
| ^~~~~~~~~~~~~~
| folio_test_head
[...]
FGP_CREAT defined in linux/pagemap.h was used in fs/aio.c, and the function
folio_end_read declared in linux/pagemap.h is also used in fs/aio.c, so fs/aio.c
need to include linux/pagemap.h.
Signed-off-by: Junjie Fu <fujunjie1@qq.com>
---
fs/aio.c | 1 +
include/linux/mempolicy.h | 1 -
mm/mempolicy.c | 1 +
3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/aio.c b/fs/aio.c
index 50671640b588..3c51c02631b2 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -38,6 +38,7 @@
#include <linux/blkdev.h>
#include <linux/compat.h>
#include <linux/migrate.h>
+#include <linux/pagemap.h>
#include <linux/ramfs.h>
#include <linux/percpu-refcount.h>
#include <linux/mount.h>
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index ce9885e0178a..d36877557b00 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -12,7 +12,6 @@
#include <linux/rbtree.h>
#include <linux/spinlock.h>
#include <linux/nodemask.h>
-#include <linux/pagemap.h>
#include <uapi/linux/mempolicy.h>
struct mm_struct;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 88eef9776bb0..c0c864b1bb67 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -98,6 +98,7 @@
#include <linux/ptrace.h>
#include <linux/swap.h>
#include <linux/seq_file.h>
+#include <linux/pagemap.h>
#include <linux/proc_fs.h>
#include <linux/migrate.h>
#include <linux/ksm.h>
--
2.34.1
Hi Junjie,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on brauner-vfs/vfs.all linus/master v6.13-rc2 next-20241211]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Junjie-Fu/mempolicy-h-Remove-unnecessary-header-file-inclusions-with-no-test-failure/20241211-120550
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/tencent_C12D22B8989E0314FDE7073D6446186E3C09%40qq.com
patch subject: [PATCH RESEND] mempolicy.h: Remove unnecessary header file inclusions with no test failure
config: sparc64-randconfig-002-20241212 (https://download.01.org/0day-ci/archive/20241212/202412120820.hwzVRrjd-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241212/202412120820.hwzVRrjd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412120820.hwzVRrjd-lkp@intel.com/
All errors (new ones prefixed by >>):
mm/z3fold.c: In function 'free_z3fold_page':
>> mm/z3fold.c:353:17: error: implicit declaration of function 'lock_page'; did you mean 'alloc_page'? [-Wimplicit-function-declaration]
353 | lock_page(page);
| ^~~~~~~~~
| alloc_page
>> mm/z3fold.c:355:17: error: implicit declaration of function 'unlock_page'; did you mean 'alloc_page'? [-Wimplicit-function-declaration]
355 | unlock_page(page);
| ^~~~~~~~~~~
| alloc_page
In file included from arch/sparc/include/asm/bug.h:25,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from arch/sparc/include/asm/current.h:15,
from include/linux/sched.h:12,
from mm/z3fold.c:27:
mm/z3fold.c: In function 'z3fold_alloc':
>> mm/z3fold.c:1056:26: error: implicit declaration of function 'trylock_page'; did you mean 'try_get_page'? [-Wimplicit-function-declaration]
1056 | WARN_ON(!trylock_page(page));
| ^~~~~~~~~~~~
include/asm-generic/bug.h:123:32: note: in definition of macro 'WARN_ON'
123 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
vim +353 mm/z3fold.c
9a001fc19cccde Vitaly Wool 2016-05-20 348
9a001fc19cccde Vitaly Wool 2016-05-20 349 /* Resets the struct page fields and frees the page */
1f862989b04ade Vitaly Wool 2019-05-13 350 static void free_z3fold_page(struct page *page, bool headless)
9a001fc19cccde Vitaly Wool 2016-05-20 351 {
1f862989b04ade Vitaly Wool 2019-05-13 352 if (!headless) {
1f862989b04ade Vitaly Wool 2019-05-13 @353 lock_page(page);
1f862989b04ade Vitaly Wool 2019-05-13 354 __ClearPageMovable(page);
1f862989b04ade Vitaly Wool 2019-05-13 @355 unlock_page(page);
1f862989b04ade Vitaly Wool 2019-05-13 356 }
5a27aa8220290b Vitaly Wool 2017-02-24 357 __free_page(page);
5a27aa8220290b Vitaly Wool 2017-02-24 358 }
5a27aa8220290b Vitaly Wool 2017-02-24 359
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Junjie,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on brauner-vfs/vfs.all linus/master v6.13-rc2 next-20241211]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Junjie-Fu/mempolicy-h-Remove-unnecessary-header-file-inclusions-with-no-test-failure/20241211-120550
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/tencent_C12D22B8989E0314FDE7073D6446186E3C09%40qq.com
patch subject: [PATCH RESEND] mempolicy.h: Remove unnecessary header file inclusions with no test failure
config: i386-buildonly-randconfig-003-20241211 (https://download.01.org/0day-ci/archive/20241212/202412120124.VtMN4Kk6-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241212/202412120124.VtMN4Kk6-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412120124.VtMN4Kk6-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from mm/z3fold.c:30:
In file included from include/linux/mm.h:2287:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> mm/z3fold.c:353:3: error: call to undeclared function 'lock_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
353 | lock_page(page);
| ^
mm/z3fold.c:353:3: note: did you mean 'copy_page'?
arch/x86/include/asm/page_32.h:25:20: note: 'copy_page' declared here
25 | static inline void copy_page(void *to, void *from)
| ^
>> mm/z3fold.c:355:3: error: call to undeclared function 'unlock_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
355 | unlock_page(page);
| ^
mm/z3fold.c:1052:3: error: call to undeclared function 'lock_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1052 | lock_page(page);
| ^
mm/z3fold.c:1054:3: error: call to undeclared function 'unlock_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1054 | unlock_page(page);
| ^
>> mm/z3fold.c:1056:12: error: call to undeclared function 'trylock_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1056 | WARN_ON(!trylock_page(page));
| ^
mm/z3fold.c:1056:12: note: did you mean 'try_get_page'?
include/linux/mm.h:1527:33: note: 'try_get_page' declared here
1527 | static inline __must_check bool try_get_page(struct page *page)
| ^
mm/z3fold.c:1058:3: error: call to undeclared function 'unlock_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1058 | unlock_page(page);
| ^
1 warning and 6 errors generated.
vim +/lock_page +353 mm/z3fold.c
9a001fc19cccdeb Vitaly Wool 2016-05-20 348
9a001fc19cccdeb Vitaly Wool 2016-05-20 349 /* Resets the struct page fields and frees the page */
1f862989b04ade6 Vitaly Wool 2019-05-13 350 static void free_z3fold_page(struct page *page, bool headless)
9a001fc19cccdeb Vitaly Wool 2016-05-20 351 {
1f862989b04ade6 Vitaly Wool 2019-05-13 352 if (!headless) {
1f862989b04ade6 Vitaly Wool 2019-05-13 @353 lock_page(page);
1f862989b04ade6 Vitaly Wool 2019-05-13 354 __ClearPageMovable(page);
1f862989b04ade6 Vitaly Wool 2019-05-13 @355 unlock_page(page);
1f862989b04ade6 Vitaly Wool 2019-05-13 356 }
5a27aa8220290b6 Vitaly Wool 2017-02-24 357 __free_page(page);
5a27aa8220290b6 Vitaly Wool 2017-02-24 358 }
5a27aa8220290b6 Vitaly Wool 2017-02-24 359
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2025 Red Hat, Inc.