diff mbox series

[v2,1/4] Make place for common balloon code

Message ID 20220816094117.3144881-2-alexander.atanasov@virtuozzo.com (mailing list archive)
State Changes Requested
Headers show
Series [v2,1/4] Make place for common balloon code | expand

Commit Message

Alexander Atanasov Aug. 16, 2022, 9:41 a.m. UTC
File already contains code that is common along balloon
drivers so rename it to reflect its contents.
mm/balloon_compaction.c -> mm/balloon_common.c

Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
---
 MAINTAINERS                                              | 4 ++--
 arch/powerpc/platforms/pseries/cmm.c                     | 2 +-
 drivers/misc/vmw_balloon.c                               | 2 +-
 drivers/virtio/virtio_balloon.c                          | 2 +-
 include/linux/{balloon_compaction.h => balloon_common.h} | 2 +-
 mm/Makefile                                              | 2 +-
 mm/{balloon_compaction.c => balloon_common.c}            | 4 ++--
 mm/migrate.c                                             | 2 +-
 mm/vmscan.c                                              | 2 +-
 9 files changed, 11 insertions(+), 11 deletions(-)
 rename include/linux/{balloon_compaction.h => balloon_common.h} (99%)
 rename mm/{balloon_compaction.c => balloon_common.c} (99%)

Comments

Alexander Atanasov Aug. 16, 2022, 11:47 a.m. UTC | #1
Hello,

On 16.08.22 12:49, Greg Kroah-Hartman wrote:
> On Tue, Aug 16, 2022 at 12:41:14PM +0300, Alexander Atanasov wrote:

>>   rename include/linux/{balloon_compaction.h => balloon_common.h} (99%)
> 
> Why rename the .h file?  It still handles the "balloon compaction"
> logic.

File contains code that is common to balloon drivers,
compaction is only part of it. Series add more code to it.
Since it was suggested to use it for such common code.
I find that common becomes a better name for it so the rename.
I can drop the rename easy on next iteration if you suggest to.
Ritesh Harjani (IBM) Aug. 18, 2022, 4:41 a.m. UTC | #2
On 22/08/16 12:41PM, Alexander Atanasov wrote:
> File already contains code that is common along balloon
> drivers so rename it to reflect its contents.
> mm/balloon_compaction.c -> mm/balloon_common.c
>
> Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
> ---
>  MAINTAINERS                                              | 4 ++--
>  arch/powerpc/platforms/pseries/cmm.c                     | 2 +-
>  drivers/misc/vmw_balloon.c                               | 2 +-
>  drivers/virtio/virtio_balloon.c                          | 2 +-
>  include/linux/{balloon_compaction.h => balloon_common.h} | 2 +-
>  mm/Makefile                                              | 2 +-
>  mm/{balloon_compaction.c => balloon_common.c}            | 4 ++--

>  mm/migrate.c                                             | 2 +-
>  mm/vmscan.c                                              | 2 +-
I think we don't need balloon headers in above two files at all.
I don't see any references of balloon functions in them.

I guess this commit removed it -

commit b1123ea6d3b3da25af5c8a9d843bd07ab63213f4
Author: Minchan Kim <minchan@kernel.org>
Date:   Tue Jul 26 15:23:09 2016 -0700

    mm: balloon: use general non-lru movable page feature

    Now, VM has a feature to migrate non-lru movable pages so balloon
    doesn't need custom migration hooks in migrate.c and compaction.c.

    Instead, this patch implements the page->mapping->a_ops->
    {isolate|migrate|putback} functions.

    With that, we could remove hooks for ballooning in general migration
    functions and make balloon compaction simple.

Since I don't often look into this side of code, it's better to confirm :)

-ritesh
Alexander Atanasov Aug. 18, 2022, 6:43 a.m. UTC | #3
Hello,

On 18.08.22 7:41, Ritesh Harjani wrote:
> On 22/08/16 12:41PM, Alexander Atanasov wrote:
>> File already contains code that is common along balloon
>> drivers so rename it to reflect its contents.
>> mm/balloon_compaction.c -> mm/balloon_common.c
>>
>> Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
>> ---
>>   MAINTAINERS                                              | 4 ++--
>>   arch/powerpc/platforms/pseries/cmm.c                     | 2 +-
>>   drivers/misc/vmw_balloon.c                               | 2 +-
>>   drivers/virtio/virtio_balloon.c                          | 2 +-
>>   include/linux/{balloon_compaction.h => balloon_common.h} | 2 +-
>>   mm/Makefile                                              | 2 +-
>>   mm/{balloon_compaction.c => balloon_common.c}            | 4 ++--
> 
>>   mm/migrate.c                                             | 2 +-
>>   mm/vmscan.c                                              | 2 +-
> I think we don't need balloon headers in above two files at all.
> I don't see any references of balloon functions in them.

...

> Since I don't often look into this side of code, it's better to confirm :)

Yes, you are right. It passed a visual and compile verification.
I will remove them in the next iteration. Thanks for pointing it out :)
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 8a5012ba6ff9..1b94bf3eb95d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21493,8 +21493,8 @@  L:	virtualization@lists.linux-foundation.org
 S:	Maintained
 F:	drivers/virtio/virtio_balloon.c
 F:	include/uapi/linux/virtio_balloon.h
-F:	include/linux/balloon_compaction.h
-F:	mm/balloon_compaction.c
+F:	include/linux/balloon_common.h
+F:	mm/balloon_common.c
 
 VIRTIO CRYPTO DRIVER
 M:	Gonglei <arei.gonglei@huawei.com>
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 5f4037c1d7fe..3beb109c7e44 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -19,7 +19,7 @@ 
 #include <linux/stringify.h>
 #include <linux/swap.h>
 #include <linux/device.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon_common.h>
 #include <asm/firmware.h>
 #include <asm/hvcall.h>
 #include <asm/mmu.h>
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 61a2be712bf7..6c6d24783548 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -29,7 +29,7 @@ 
 #include <linux/rwsem.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon_common.h>
 #include <linux/vmw_vmci_defs.h>
 #include <linux/vmw_vmci_api.h>
 #include <asm/hypervisor.h>
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 3f78a3a1eb75..6f69e483d98a 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -13,7 +13,7 @@ 
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/module.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon_common.h>
 #include <linux/oom.h>
 #include <linux/wait.h>
 #include <linux/mm.h>
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_common.h
similarity index 99%
rename from include/linux/balloon_compaction.h
rename to include/linux/balloon_common.h
index 5ca2d5699620..a45e9fd76235 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_common.h
@@ -1,6 +1,6 @@ 
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * include/linux/balloon_compaction.h
+ * include/linux/balloon_common.h
  *
  * Common interface definitions for making balloon pages movable by compaction.
  *
diff --git a/mm/Makefile b/mm/Makefile
index 9a564f836403..a3390f255b82 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -112,7 +112,7 @@  obj-$(CONFIG_ZSMALLOC)	+= zsmalloc.o
 obj-$(CONFIG_Z3FOLD)	+= z3fold.o
 obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
 obj-$(CONFIG_CMA)	+= cma.o
-obj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o
+obj-$(CONFIG_MEMORY_BALLOON) += balloon_common.o
 obj-$(CONFIG_PAGE_EXTENSION) += page_ext.o
 obj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o
 obj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
diff --git a/mm/balloon_compaction.c b/mm/balloon_common.c
similarity index 99%
rename from mm/balloon_compaction.c
rename to mm/balloon_common.c
index 22c96fed70b5..54ed98653c78 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_common.c
@@ -1,6 +1,6 @@ 
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * mm/balloon_compaction.c
+ * mm/balloon_common.c
  *
  * Common interface for making balloon pages movable by compaction.
  *
@@ -9,7 +9,7 @@ 
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/export.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon_common.h>
 
 static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
 				     struct page *page)
diff --git a/mm/migrate.c b/mm/migrate.c
index 6a1597c92261..a6df467a250a 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -41,7 +41,7 @@ 
 #include <linux/pfn_t.h>
 #include <linux/memremap.h>
 #include <linux/userfaultfd_k.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon_common.h>
 #include <linux/page_idle.h>
 #include <linux/page_owner.h>
 #include <linux/sched/mm.h>
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b2b1431352dc..4732f8c24264 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -54,7 +54,7 @@ 
 #include <asm/div64.h>
 
 #include <linux/swapops.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon_common.h>
 #include <linux/sched/sysctl.h>
 
 #include "internal.h"