Re: [Pv-drivers] [PATCH v2] VMware Balloon driver

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dmitry Torokhov
Date: Wednesday, April 21, 2010 - 6:02 pm

On Wed, Apr 21, 2010 at 05:00:49PM -0700, Dmitry Torokhov wrote:

OK, so here is the incremental patch addressing your comments. Or do you
want the entire thing resent?

Thanks.

-- 
Dmitry


vmware-balloon: miscellaneous fixes

 - document rate allocation constants
 - do not compile statistics code when debugfs is disabled
 - fix compilation error when debugfs is disabled

Signed-off-by: Dmitry Torokhov <dtor@vmware.com>
---

 drivers/misc/vmware_balloon.c |   38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)


diff --git a/drivers/misc/vmware_balloon.c b/drivers/misc/vmware_balloon.c
index 90bba04..e7161c4 100644
--- a/drivers/misc/vmware_balloon.c
+++ b/drivers/misc/vmware_balloon.c
@@ -50,12 +50,28 @@ MODULE_ALIAS("dmi:*:svnVMware*:*");
 MODULE_ALIAS("vmware_vmmemctl");
 MODULE_LICENSE("GPL");
 
+/*
+ * Various constants controlling rate of inflaint/deflating balloon,
+ * measured in pages.
+ */
+
+/*
+ * Rate of allocating memory when there is no memory pressure
+ * (driver performs non-sleeping allocations).
+ */
 #define VMW_BALLOON_NOSLEEP_ALLOC_MAX	16384U
 
+/*
+ * Rates of memory allocaton when guest experiences memory pressure
+ * (driver performs sleeping allocations).
+ */
 #define VMW_BALLOON_RATE_ALLOC_MIN	512U
 #define VMW_BALLOON_RATE_ALLOC_MAX	2048U
 #define VMW_BALLOON_RATE_ALLOC_INC	16U
 
+/*
+ * Rates for releasing pages while deflating balloon.
+ */
 #define VMW_BALLOON_RATE_FREE_MIN	512U
 #define VMW_BALLOON_RATE_FREE_MAX	16384U
 #define VMW_BALLOON_RATE_FREE_INC	16U
@@ -85,6 +101,10 @@ MODULE_LICENSE("GPL");
 /* Maximum number of page allocations without yielding processor */
 #define VMW_BALLOON_YIELD_THRESHOLD	1024
 
+
+/*
+ * Hypervisor communication port definitions.
+ */
 #define VMW_BALLOON_HV_PORT		0x5670
 #define VMW_BALLOON_HV_MAGIC		0x456c6d6f
 #define VMW_BALLOON_PROTOCOL_VERSION	2
@@ -125,8 +145,7 @@ MODULE_LICENSE("GPL");
 	__stat & -1UL;					\
 })
 
-#define STATS_INC(stat) (stat)++
-
+#ifdef CONFIG_DEBUG_FS
 struct vmballoon_stats {
 	unsigned int timer;
 
@@ -152,6 +171,11 @@ struct vmballoon_stats {
 	unsigned int guest_type_fail;
 };
 
+#define STATS_INC(stat) (stat)++
+#else
+#define STATS_INC(stat)
+#endif
+
 struct vmballoon {
 
 	/* list of reserved physical pages */
@@ -174,11 +198,13 @@ struct vmballoon {
 	/* slowdown page allocations for next few cycles */
 	unsigned int slow_allocation_cycles;
 
+#ifdef CONFIG_DEBUG_FS
 	/* statistics */
 	struct vmballoon_stats stats;
 
 	/* debugfs file exporting statistics */
 	struct dentry *dbg_entry;
+#endif
 
 	struct sysinfo sysinfo;
 
@@ -637,7 +663,7 @@ static void vmballoon_work(struct work_struct *work)
 }
 
 /*
- * PROCFS Interface
+ * DEBUGFS Interface
  */
 #ifdef CONFIG_DEBUG_FS
 
@@ -727,11 +753,11 @@ static inline int vmballoon_debugfs_init(struct vmballoon *b)
 	return 0;
 }
 
-static inline void vmballoon_debugfs_exit(void)
+static inline void vmballoon_debugfs_exit(struct vmballoon *b)
 {
 }
 
-#endif	/* CONFIG_PROC_FS */
+#endif	/* CONFIG_DEBUG_FS */
 
 static int __init vmballoon_init(void)
 {
@@ -750,8 +776,6 @@ static int __init vmballoon_init(void)
 		return -ENOMEM;
 	}
 
-	/* initialize global state */
-	memset(&balloon, 0, sizeof(balloon));
 	INIT_LIST_HEAD(&balloon.pages);
 	INIT_LIST_HEAD(&balloon.refused_pages);
 

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] VMware Balloon driver, Dmitry Torokhov, (Sun Apr 4, 2:52 pm)
Re: [PATCH] VMware Balloon driver, Andrew Morton, (Mon Apr 5, 2:24 pm)
Re: [PATCH] VMware Balloon driver, Jeremy Fitzhardinge, (Mon Apr 5, 3:03 pm)
Re: [PATCH] VMware Balloon driver, Andrew Morton, (Mon Apr 5, 3:17 pm)
Re: [PATCH] VMware Balloon driver, Avi Kivity, (Mon Apr 5, 3:26 pm)
Re: [PATCH] VMware Balloon driver, Andrew Morton, (Mon Apr 5, 3:40 pm)
Re: [PATCH] VMware Balloon driver, Dmitry Torokhov, (Mon Apr 5, 3:58 pm)
Re: [PATCH] VMware Balloon driver, Dmitry Torokhov, (Mon Apr 5, 4:01 pm)
RE: [PATCH] VMware Balloon driver, Dan Magenheimer, (Mon Apr 5, 4:03 pm)
Re: [PATCH] VMware Balloon driver, Andrew Morton, (Mon Apr 5, 4:11 pm)
Re: [PATCH] VMware Balloon driver, Dmitry Torokhov, (Mon Apr 5, 4:28 pm)
Re: [PATCH] VMware Balloon driver, Jeremy Fitzhardinge, (Mon Apr 5, 4:28 pm)
Re: [PATCH] VMware Balloon driver, Andrew Morton, (Mon Apr 5, 4:34 pm)
RE: [PATCH] VMware Balloon driver, Dan Magenheimer, (Mon Apr 5, 5:26 pm)
[No subject], Avi Kivity, (Tue Apr 6, 9:28 am)
[No subject], Avi Kivity, (Tue Apr 6, 9:30 am)
[No subject], Avi Kivity, (Tue Apr 6, 9:32 am)
[No subject], Dmitry Torokhov, (Tue Apr 6, 10:06 am)
[No subject], Dan Magenheimer, (Tue Apr 6, 10:27 am)
[No subject], Avi Kivity, (Tue Apr 6, 10:42 am)
Re: [PATCH] VMware Balloon driver, Jeremy Fitzhardinge, (Tue Apr 6, 11:25 am)
Re: [PATCH] VMware Balloon driver, Avi Kivity, (Tue Apr 6, 11:36 am)
Re: [PATCH] VMware Balloon driver, Jeremy Fitzhardinge, (Tue Apr 6, 12:18 pm)
Re: [PATCH] VMware Balloon driver, Dave Hansen, (Tue Apr 6, 4:20 pm)
Re: [PATCH] VMware Balloon driver, Pavel Machek, (Wed Apr 7, 10:30 pm)
Re: [PATCH] VMware Balloon driver, Avi Kivity, (Thu Apr 8, 12:18 am)
Re: [PATCH] VMware Balloon driver, Jeremy Fitzhardinge, (Thu Apr 8, 10:01 am)
[PATCH v2] VMware Balloon driver, Dmitry Torokhov, (Thu Apr 15, 2:00 pm)
Re: [PATCH v2] VMware Balloon driver, Dmitry Torokhov, (Wed Apr 21, 12:59 pm)
Re: [PATCH v2] VMware Balloon driver, Andrew Morton, (Wed Apr 21, 1:18 pm)
Re: [PATCH v2] VMware Balloon driver, Dmitry Torokhov, (Wed Apr 21, 1:52 pm)
Re: [PATCH v2] VMware Balloon driver, Andrew Morton, (Wed Apr 21, 2:13 pm)
Re: [PATCH v2] VMware Balloon driver, Andrew Morton, (Wed Apr 21, 4:54 pm)
Re: [PATCH v2] VMware Balloon driver, Dmitry Torokhov, (Wed Apr 21, 5:00 pm)
Re: [PATCH v2] VMware Balloon driver, Dmitry Torokhov, (Wed Apr 21, 5:09 pm)
Re: [Pv-drivers] [PATCH v2] VMware Balloon driver, Dmitry Torokhov, (Wed Apr 21, 6:02 pm)