2022-02-08 03:28:41

by Christoph Hellwig

[permalink] [raw]
Subject: [PATCH 3/8] mm: remove pointless includes from <linux/hmm.h>

hmm.h pulls in the world for no good reason at all. Remove the
includes and push a few ones into the users instead.

Signed-off-by: Christoph Hellwig <[email protected]>
---
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 1 +
drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 +
include/linux/hmm.h | 9 ++-------
lib/test_hmm.c | 2 ++
4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
index ed5385137f4831..cb835f95a76e66 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
@@ -24,6 +24,7 @@
#include <linux/hmm.h>
#include <linux/dma-direction.h>
#include <linux/dma-mapping.h>
+#include <linux/migrate.h>
#include "amdgpu_sync.h"
#include "amdgpu_object.h"
#include "amdgpu_vm.h"
diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index 3828aafd3ac46f..e886a3b9e08c7d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -39,6 +39,7 @@

#include <linux/sched/mm.h>
#include <linux/hmm.h>
+#include <linux/migrate.h>

/*
* FIXME: this is ugly right now we are using TTM to allocate vram and we pin
diff --git a/include/linux/hmm.h b/include/linux/hmm.h
index 2fd2e91d5107c0..d5a6f101f843e6 100644
--- a/include/linux/hmm.h
+++ b/include/linux/hmm.h
@@ -9,14 +9,9 @@
#ifndef LINUX_HMM_H
#define LINUX_HMM_H

-#include <linux/kconfig.h>
-#include <linux/pgtable.h>
+#include <linux/mm.h>

-#include <linux/device.h>
-#include <linux/migrate.h>
-#include <linux/memremap.h>
-#include <linux/completion.h>
-#include <linux/mmu_notifier.h>
+struct mmu_interval_notifier;

/*
* On output:
diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 767538089a62e4..396beee6b061d4 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -26,6 +26,8 @@
#include <linux/sched/mm.h>
#include <linux/platform_device.h>
#include <linux/rmap.h>
+#include <linux/mmu_notifier.h>
+#include <linux/migrate.h>

#include "test_hmm_uapi.h"

--
2.30.2



2022-02-09 09:50:26

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH 3/8] mm: remove pointless includes from <linux/hmm.h>

On Mon, Feb 07, 2022 at 07:32:44AM +0100, Christoph Hellwig wrote:
> hmm.h pulls in the world for no good reason at all. Remove the
> includes and push a few ones into the users instead.
>
> Signed-off-by: Christoph Hellwig <[email protected]>
> ---
> drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 1 +
> drivers/gpu/drm/nouveau/nouveau_dmem.c | 1 +
> include/linux/hmm.h | 9 ++-------
> lib/test_hmm.c | 2 ++
> 4 files changed, 6 insertions(+), 7 deletions(-)

Reviewed-by: Jason Gunthorpe <[email protected]>

Jason

2022-02-09 11:20:18

by Chaitanya Kulkarni

[permalink] [raw]
Subject: Re: [PATCH 3/8] mm: remove pointless includes from <linux/hmm.h>

On 2/6/22 10:32 PM, Christoph Hellwig wrote:
> hmm.h pulls in the world for no good reason at all. Remove the
> includes and push a few ones into the users instead.
>
> Signed-off-by: Christoph Hellwig<[email protected]>

Looks good.

Reviewed-by: Chaitanya Kulkarni <[email protected]>