linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] Make place for common balloon code
       [not found] <20220816094117.3144881-1-alexander.atanasov@virtuozzo.com>
@ 2022-08-16  9:41 ` Alexander Atanasov
  2022-08-16  9:49   ` Greg Kroah-Hartman
  2022-08-18  4:41   ` Ritesh Harjani
  2022-08-16  9:41 ` [PATCH v2 2/4] Enable balloon drivers to report inflated memory Alexander Atanasov
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Alexander Atanasov @ 2022-08-16  9:41 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Nadav Amit,
	VMware PV-Drivers Reviewers, Arnd Bergmann, Greg Kroah-Hartman,
	Michael S. Tsirkin, David Hildenbrand, Jason Wang, Andrew Morton
  Cc: kernel, Alexander Atanasov, linux-kernel, linuxppc-dev,
	virtualization, linux-mm

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%)

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"
-- 
2.31.1


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

* [PATCH v2 2/4] Enable balloon drivers to report inflated memory
       [not found] <20220816094117.3144881-1-alexander.atanasov@virtuozzo.com>
  2022-08-16  9:41 ` [PATCH v2 1/4] Make place for common balloon code Alexander Atanasov
@ 2022-08-16  9:41 ` Alexander Atanasov
  2022-08-16  9:41 ` [PATCH v2 3/4] Display inflated memory to users Alexander Atanasov
  2022-08-16  9:41 ` [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory Alexander Atanasov
  3 siblings, 0 replies; 12+ messages in thread
From: Alexander Atanasov @ 2022-08-16  9:41 UTC (permalink / raw)
  To: Michael S. Tsirkin, David Hildenbrand, Andrew Morton
  Cc: kernel, Alexander Atanasov, virtualization, linux-kernel, linux-mm

Add counters to be updated by the balloon drivers.
Create balloon notifier to propagate changes.

Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
---
 include/linux/balloon_common.h | 18 ++++++++++++++++++
 mm/balloon_common.c            | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/include/linux/balloon_common.h b/include/linux/balloon_common.h
index a45e9fd76235..e707f57f58da 100644
--- a/include/linux/balloon_common.h
+++ b/include/linux/balloon_common.h
@@ -59,6 +59,24 @@ struct balloon_dev_info {
 			struct page *page, enum migrate_mode mode);
 };
 
+extern atomic_long_t mem_balloon_inflated_total_kb;
+extern atomic_long_t mem_balloon_inflated_free_kb;
+
+void balloon_set_inflated_total(long inflated_kb);
+void balloon_set_inflated_free(long inflated_kb);
+
+#define BALLOON_CHANGED_TOTAL 0
+#define BALLOON_CHANGED_FREE  1
+
+extern int register_balloon_notifier(struct notifier_block *nb);
+extern void unregister_balloon_notifier(struct notifier_block *nb);
+
+#define balloon_notifier(fn, pri) ({						\
+	static struct notifier_block fn##_mem_nb __meminitdata =\
+		{ .notifier_call = fn, .priority = pri };			\
+	register_balloon_notifier(&fn##_mem_nb);				\
+})
+
 extern struct page *balloon_page_alloc(void);
 extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
 				 struct page *page);
diff --git a/mm/balloon_common.c b/mm/balloon_common.c
index 54ed98653c78..abeee6882649 100644
--- a/mm/balloon_common.c
+++ b/mm/balloon_common.c
@@ -9,8 +9,42 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/export.h>
+#include <linux/notifier.h>
 #include <linux/balloon_common.h>
 
+atomic_long_t mem_balloon_inflated_total_kb = ATOMIC_LONG_INIT(0);
+atomic_long_t mem_balloon_inflated_free_kb = ATOMIC_LONG_INIT(0);
+SRCU_NOTIFIER_HEAD_STATIC(balloon_chain);
+
+int register_balloon_notifier(struct notifier_block *nb)
+{
+	return srcu_notifier_chain_register(&balloon_chain, nb);
+}
+EXPORT_SYMBOL(register_balloon_notifier);
+
+void unregister_balloon_notifier(struct notifier_block *nb)
+{
+	srcu_notifier_chain_unregister(&balloon_chain, nb);
+}
+EXPORT_SYMBOL(unregister_balloon_notifier);
+
+static int balloon_notify(unsigned long val)
+{
+	return srcu_notifier_call_chain(&balloon_chain, val, NULL);
+}
+
+void balloon_set_inflated_total(long inflated_kb)
+{
+	atomic_long_set(&mem_balloon_inflated_total_kb, inflated_kb);
+	balloon_notify(BALLOON_CHANGED_TOTAL);
+}
+
+void balloon_set_inflated_free(long inflated_kb)
+{
+	atomic_long_set(&mem_balloon_inflated_free_kb, inflated_kb);
+	balloon_notify(BALLOON_CHANGED_FREE);
+}
+
 static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
 				     struct page *page)
 {
-- 
2.31.1


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

* [PATCH v2 3/4] Display inflated memory to users
       [not found] <20220816094117.3144881-1-alexander.atanasov@virtuozzo.com>
  2022-08-16  9:41 ` [PATCH v2 1/4] Make place for common balloon code Alexander Atanasov
  2022-08-16  9:41 ` [PATCH v2 2/4] Enable balloon drivers to report inflated memory Alexander Atanasov
@ 2022-08-16  9:41 ` Alexander Atanasov
  2022-08-16  9:41 ` [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory Alexander Atanasov
  3 siblings, 0 replies; 12+ messages in thread
From: Alexander Atanasov @ 2022-08-16  9:41 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: kernel, Alexander Atanasov, linux-kernel, linux-fsdevel, linux-doc

Add InflatedTotal and InflatedFree to /proc/meminfo

Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
---
 Documentation/filesystems/proc.rst |  6 ++++++
 fs/proc/meminfo.c                  | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst
index e7aafc82be99..690e1b90ffee 100644
--- a/Documentation/filesystems/proc.rst
+++ b/Documentation/filesystems/proc.rst
@@ -991,6 +991,8 @@ Example output. You may not have all of these fields.
     VmallocUsed:       40444 kB
     VmallocChunk:          0 kB
     Percpu:            29312 kB
+    InflatedTotal:   2097152 kB
+    InflatedFree:          0 kB
     HardwareCorrupted:     0 kB
     AnonHugePages:   4149248 kB
     ShmemHugePages:        0 kB
@@ -1138,6 +1140,10 @@ VmallocChunk
 Percpu
               Memory allocated to the percpu allocator used to back percpu
               allocations. This stat excludes the cost of metadata.
+InflatedTotal and InflatedFree
+               Amount of memory that is inflated by the balloon driver.
+               Due to differences among the drivers inflated memory
+               is subtracted from TotalRam or from MemFree.
 HardwareCorrupted
               The amount of RAM/memory in KB, the kernel identifies as
               corrupted.
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 6e89f0e2fd20..f72af204151a 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -16,6 +16,9 @@
 #ifdef CONFIG_CMA
 #include <linux/cma.h>
 #endif
+#ifdef CONFIG_MEMORY_BALLOON
+#include <linux/balloon_common.h>
+#endif
 #include <asm/page.h>
 #include "internal.h"
 
@@ -153,6 +156,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 		    global_zone_page_state(NR_FREE_CMA_PAGES));
 #endif
 
+#ifdef CONFIG_MEMORY_BALLOON
+	seq_printf(m,  "InflatedTotal:  %8ld kB\n",
+		atomic_long_read(&mem_balloon_inflated_total_kb));
+	seq_printf(m,  "InflatedFree:   %8ld kB\n",
+		atomic_long_read(&mem_balloon_inflated_free_kb));
+#endif
+
 	hugetlb_report_meminfo(m);
 
 	arch_report_meminfo(m);
-- 
2.31.1


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

* [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory
       [not found] <20220816094117.3144881-1-alexander.atanasov@virtuozzo.com>
                   ` (2 preceding siblings ...)
  2022-08-16  9:41 ` [PATCH v2 3/4] Display inflated memory to users Alexander Atanasov
@ 2022-08-16  9:41 ` Alexander Atanasov
  2022-08-16 22:17   ` kernel test robot
  2022-08-17  5:09   ` kernel test robot
  3 siblings, 2 replies; 12+ messages in thread
From: Alexander Atanasov @ 2022-08-16  9:41 UTC (permalink / raw)
  To: Michael S. Tsirkin, David Hildenbrand, Jason Wang
  Cc: kernel, Alexander Atanasov, virtualization, linux-kernel

Update the inflated memory when it changes.

Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
---
 drivers/virtio/virtio_balloon.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 6f69e483d98a..c8093c704c2f 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -450,10 +450,15 @@ static void virtballoon_changed(struct virtio_device *vdev)
 static void update_balloon_size(struct virtio_balloon *vb)
 {
 	u32 actual = vb->num_pages;
+	long inflated_kb = actual << (VIRTIO_BALLOON_PFN_SHIFT - 10);
 
 	/* Legacy balloon config space is LE, unlike all other devices. */
 	virtio_cwrite_le(vb->vdev, struct virtio_balloon_config, actual,
 			 &actual);
+	if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
+		balloon_set_inflated_free(inflated_kb);
+	else
+		balloon_set_inflated_total(inflated_kb);
 }
 
 static void update_balloon_stats_func(struct work_struct *work)
-- 
2.31.1


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

* Re: [PATCH v2 1/4] Make place for common balloon code
  2022-08-16  9:41 ` [PATCH v2 1/4] Make place for common balloon code Alexander Atanasov
@ 2022-08-16  9:49   ` Greg Kroah-Hartman
  2022-08-16 11:47     ` Alexander Atanasov
  2022-08-18  4:41   ` Ritesh Harjani
  1 sibling, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2022-08-16  9:49 UTC (permalink / raw)
  To: Alexander Atanasov
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Nadav Amit,
	VMware PV-Drivers Reviewers, Arnd Bergmann, Michael S. Tsirkin,
	David Hildenbrand, Jason Wang, Andrew Morton, kernel,
	linux-kernel, linuxppc-dev, virtualization, linux-mm

On Tue, Aug 16, 2022 at 12:41:14PM +0300, 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 +-
>  9 files changed, 11 insertions(+), 11 deletions(-)
>  rename include/linux/{balloon_compaction.h => balloon_common.h} (99%)

Why rename the .h file?  It still handles the "balloon compaction"
logic.

thanks,

greg k-h

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

* Re: [PATCH v2 1/4] Make place for common balloon code
  2022-08-16  9:49   ` Greg Kroah-Hartman
@ 2022-08-16 11:47     ` Alexander Atanasov
  2022-08-16 11:56       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 12+ messages in thread
From: Alexander Atanasov @ 2022-08-16 11:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Nadav Amit,
	VMware PV-Drivers Reviewers, Arnd Bergmann, Michael S. Tsirkin,
	David Hildenbrand, Jason Wang, Andrew Morton, kernel,
	linux-kernel, linuxppc-dev, virtualization, linux-mm

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.

-- 
Regards,
Alexander Atanasov


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

* Re: [PATCH v2 1/4] Make place for common balloon code
  2022-08-16 11:47     ` Alexander Atanasov
@ 2022-08-16 11:56       ` Greg Kroah-Hartman
  2022-08-16 12:00         ` Michael S. Tsirkin
  0 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2022-08-16 11:56 UTC (permalink / raw)
  To: Alexander Atanasov
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Nadav Amit,
	VMware PV-Drivers Reviewers, Arnd Bergmann, Michael S. Tsirkin,
	David Hildenbrand, Jason Wang, Andrew Morton, kernel,
	linux-kernel, linuxppc-dev, virtualization, linux-mm

On Tue, Aug 16, 2022 at 02:47:22PM +0300, Alexander Atanasov wrote:
> 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.

"balloon_common.h" is very vague, you should only need one balloon.h
file in the include/linux/ directory, right, so of course it is "common"
:)

thanks,

greg "naming is hard" k-h

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

* Re: [PATCH v2 1/4] Make place for common balloon code
  2022-08-16 11:56       ` Greg Kroah-Hartman
@ 2022-08-16 12:00         ` Michael S. Tsirkin
  0 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2022-08-16 12:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alexander Atanasov, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy, Nadav Amit, VMware PV-Drivers Reviewers,
	Arnd Bergmann, David Hildenbrand, Jason Wang, Andrew Morton,
	kernel, linux-kernel, linuxppc-dev, virtualization, linux-mm

On Tue, Aug 16, 2022 at 01:56:32PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Aug 16, 2022 at 02:47:22PM +0300, Alexander Atanasov wrote:
> > 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.
> 
> "balloon_common.h" is very vague, you should only need one balloon.h
> file in the include/linux/ directory, right, so of course it is "common"
> :)
> 
> thanks,
> 
> greg "naming is hard" k-h

Yea, just call it balloon.h and balloon.c then.

-- 
MST


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

* Re: [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory
  2022-08-16  9:41 ` [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory Alexander Atanasov
@ 2022-08-16 22:17   ` kernel test robot
  2022-08-17  5:09   ` kernel test robot
  1 sibling, 0 replies; 12+ messages in thread
From: kernel test robot @ 2022-08-16 22:17 UTC (permalink / raw)
  To: Alexander Atanasov, Michael S. Tsirkin, David Hildenbrand, Jason Wang
  Cc: kbuild-all, kernel, Alexander Atanasov, virtualization, linux-kernel

Hi Alexander,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on char-misc/char-misc-testing linus/master v6.0-rc1 next-20220816]
[cannot apply to soc/for-next]
[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/Alexander-Atanasov/Make-place-for-common-balloon-code/20220816-184943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: i386-buildonly-randconfig-r004-20220815 (https://download.01.org/0day-ci/archive/20220817/202208170648.gcM3nXqB-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/d37f8ca37c57eb9e68b55ef33ecfce719f98bfe7
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Alexander-Atanasov/Make-place-for-common-balloon-code/20220816-184943
        git checkout d37f8ca37c57eb9e68b55ef33ecfce719f98bfe7
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "balloon_set_inflated_free" [drivers/virtio/virtio_balloon.ko] undefined!
>> ERROR: modpost: "balloon_set_inflated_total" [drivers/virtio/virtio_balloon.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory
  2022-08-16  9:41 ` [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory Alexander Atanasov
  2022-08-16 22:17   ` kernel test robot
@ 2022-08-17  5:09   ` kernel test robot
  1 sibling, 0 replies; 12+ messages in thread
From: kernel test robot @ 2022-08-17  5:09 UTC (permalink / raw)
  To: Alexander Atanasov, Michael S. Tsirkin, David Hildenbrand, Jason Wang
  Cc: llvm, kbuild-all, kernel, Alexander Atanasov, virtualization,
	linux-kernel

Hi Alexander,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on char-misc/char-misc-testing linus/master v6.0-rc1 next-20220816]
[cannot apply to soc/for-next]
[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/Alexander-Atanasov/Make-place-for-common-balloon-code/20220816-184943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: x86_64-randconfig-a001 (https://download.01.org/0day-ci/archive/20220817/202208171338.xAU3O9KJ-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/d37f8ca37c57eb9e68b55ef33ecfce719f98bfe7
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Alexander-Atanasov/Make-place-for-common-balloon-code/20220816-184943
        git checkout d37f8ca37c57eb9e68b55ef33ecfce719f98bfe7
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "balloon_set_inflated_total" [drivers/virtio/virtio_balloon.ko] undefined!
>> ERROR: modpost: "balloon_set_inflated_free" [drivers/virtio/virtio_balloon.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH v2 1/4] Make place for common balloon code
  2022-08-16  9:41 ` [PATCH v2 1/4] Make place for common balloon code Alexander Atanasov
  2022-08-16  9:49   ` Greg Kroah-Hartman
@ 2022-08-18  4:41   ` Ritesh Harjani
  2022-08-18  6:43     ` Alexander Atanasov
  1 sibling, 1 reply; 12+ messages in thread
From: Ritesh Harjani @ 2022-08-18  4:41 UTC (permalink / raw)
  To: Alexander Atanasov
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Nadav Amit,
	VMware PV-Drivers Reviewers, Arnd Bergmann, Greg Kroah-Hartman,
	Michael S. Tsirkin, David Hildenbrand, Jason Wang, Andrew Morton,
	kernel, linux-kernel, linuxppc-dev, virtualization, linux-mm

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

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

* Re: [PATCH v2 1/4] Make place for common balloon code
  2022-08-18  4:41   ` Ritesh Harjani
@ 2022-08-18  6:43     ` Alexander Atanasov
  0 siblings, 0 replies; 12+ messages in thread
From: Alexander Atanasov @ 2022-08-18  6:43 UTC (permalink / raw)
  To: Ritesh Harjani
  Cc: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Nadav Amit,
	VMware PV-Drivers Reviewers, Arnd Bergmann, Greg Kroah-Hartman,
	Michael S. Tsirkin, David Hildenbrand, Jason Wang, Andrew Morton,
	kernel, linux-kernel, linuxppc-dev, virtualization, linux-mm

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 :)

-- 
Regards,
Alexander Atanasov


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

end of thread, other threads:[~2022-08-18  6:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220816094117.3144881-1-alexander.atanasov@virtuozzo.com>
2022-08-16  9:41 ` [PATCH v2 1/4] Make place for common balloon code Alexander Atanasov
2022-08-16  9:49   ` Greg Kroah-Hartman
2022-08-16 11:47     ` Alexander Atanasov
2022-08-16 11:56       ` Greg Kroah-Hartman
2022-08-16 12:00         ` Michael S. Tsirkin
2022-08-18  4:41   ` Ritesh Harjani
2022-08-18  6:43     ` Alexander Atanasov
2022-08-16  9:41 ` [PATCH v2 2/4] Enable balloon drivers to report inflated memory Alexander Atanasov
2022-08-16  9:41 ` [PATCH v2 3/4] Display inflated memory to users Alexander Atanasov
2022-08-16  9:41 ` [PATCH v2 4/4] drivers: virtio: balloon - update inflated memory Alexander Atanasov
2022-08-16 22:17   ` kernel test robot
2022-08-17  5:09   ` 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;
as well as URLs for NNTP newsgroup(s).