linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] mempolicy.h: Remove unnecessary header file inclusions with no test failure
@ 2024-12-11  4:01 Junjie Fu
  2024-12-11 17:18 ` kernel test robot
  2024-12-12  0:21 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Junjie Fu @ 2024-12-11  4:01 UTC (permalink / raw)
  To: linux-mm, akpm; +Cc: linux-kernel, willy, sj, Junjie Fu

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-12  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-11  4:01 [PATCH RESEND] mempolicy.h: Remove unnecessary header file inclusions with no test failure Junjie Fu
2024-12-11 17:18 ` kernel test robot
2024-12-12  0:21 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox