diff mbox series

mm: migrate: remove unused includes

Message ID 20240904095849.861620-1-wangkefeng.wang@huawei.com (mailing list archive)
State New
Headers show
Series mm: migrate: remove unused includes | expand

Commit Message

Kefeng Wang Sept. 4, 2024, 9:58 a.m. UTC
Some includes are not need anymore, remove them.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 mm/migrate.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Andrew Morton Sept. 4, 2024, 8:54 p.m. UTC | #1
On Wed, 4 Sep 2024 17:58:49 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:

> Some includes are not need anymore, remove them.
> 

Please define "not needed".  Does migrate.c simply not refer to
anything which these headers provide?  Or does migrate.c already pick
up these headers via nested includes?

If the latter then that can be a problem - build breakage under rare
configs, or as code generally evolves.  Not a *big* problem - we detect
and fix such things quickly, but I do think general good practice is to
directly include whatever the .c file requires.
Kefeng Wang Sept. 5, 2024, 1:18 a.m. UTC | #2
On 2024/9/5 4:54, Andrew Morton wrote:
> On Wed, 4 Sep 2024 17:58:49 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> 
>> Some includes are not need anymore, remove them.
>>
> 
> Please define "not needed".  Does migrate.c simply not refer to
Agree.

> anything which these headers provide?  Or does migrate.c already pick
> up these headers via nested includes?
> 
> If the latter then that can be a problem - build breakage under rare
> configs, or as code generally evolves.  Not a *big* problem - we detect
> and fix such things quickly, but I do think general good practice is to
> directly include whatever the .c file requires.

Yes, I could add more infos,

random.h not needed since commit 6c542ab75714 ("mm/demotion: build 
demotion targets based on explicit memory tiers"), all functions moved
into memory-tiers.

nsproxy.h not needed since commit 228ebcbe634a ("Uninline 
find_task_by_xxx set of functions"), no nsproxy, we only call
find_task_by_vpid() now.

hugetlb_cgroup.h not needed since commit ab5ac90aecf5 ("mm, hugetlb: do 
not rely on overcommit limit during migration"), move_hugetlb_state() is
called and it belongs to hugetlb.h, which is already included.


memremap.h, userfaultfd_k.h and oom.h are introduced for zone device
page migration, but all functions are moved into migrate_device.c, so no
needed too.
Kefeng Wang Sept. 5, 2024, 1:26 a.m. UTC | #3
On 2024/9/5 9:18, Kefeng Wang wrote:
> 
> 
> On 2024/9/5 4:54, Andrew Morton wrote:
>> On Wed, 4 Sep 2024 17:58:49 +0800 Kefeng Wang 
>> <wangkefeng.wang@huawei.com> wrote:
>>
>>> Some includes are not need anymore, remove them.
>>>
>>
>> Please define "not needed".  Does migrate.c simply not refer to
> Agree.
> 
>> anything which these headers provide?  Or does migrate.c already pick
>> up these headers via nested includes?
>>
>> If the latter then that can be a problem - build breakage under rare
>> configs, or as code generally evolves.  Not a *big* problem - we detect
>> and fix such things quickly, but I do think general good practice is to
>> directly include whatever the .c file requires.
> 
> Yes, I could add more infos,
> 
> random.h not needed since commit 6c542ab75714 ("mm/demotion: build 
> demotion targets based on explicit memory tiers"), all functions moved
> into memory-tiers.
> 
> nsproxy.h not needed since commit 228ebcbe634a ("Uninline 
> find_task_by_xxx set of functions"), no nsproxy, we only call
> find_task_by_vpid() now.
> 
> hugetlb_cgroup.h not needed since commit ab5ac90aecf5 ("mm, hugetlb: do 
> not rely on overcommit limit during migration"), move_hugetlb_state() is
> called and it belongs to hugetlb.h, which is already included.
> 
> 
> memremap.h, userfaultfd_k.h and oom.h are introduced for zone device
> page migration, but all functions are moved into migrate_device.c, so no
> needed too.

and for balloon_compaction.h, we have more general movable_operations
for non-lru movable page migration, so it could be dropped.

> 
>
diff mbox series

Patch

diff --git a/mm/migrate.c b/mm/migrate.c
index 35cc9d35064b..7d2bf86cc113 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -20,7 +20,6 @@ 
 #include <linux/pagemap.h>
 #include <linux/buffer_head.h>
 #include <linux/mm_inline.h>
-#include <linux/nsproxy.h>
 #include <linux/ksm.h>
 #include <linux/rmap.h>
 #include <linux/topology.h>
@@ -35,19 +34,13 @@ 
 #include <linux/syscalls.h>
 #include <linux/compat.h>
 #include <linux/hugetlb.h>
-#include <linux/hugetlb_cgroup.h>
 #include <linux/gfp.h>
 #include <linux/pfn_t.h>
-#include <linux/memremap.h>
-#include <linux/userfaultfd_k.h>
-#include <linux/balloon_compaction.h>
 #include <linux/page_idle.h>
 #include <linux/page_owner.h>
 #include <linux/sched/mm.h>
 #include <linux/ptrace.h>
-#include <linux/oom.h>
 #include <linux/memory.h>
-#include <linux/random.h>
 #include <linux/sched/sysctl.h>
 #include <linux/memory-tiers.h>
 #include <linux/pagewalk.h>