linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hv_balloon: Add module parameter to configure balloon floor value
@ 2023-10-10 22:48 Angelina Vu
  2023-10-10 23:16 ` Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Angelina Vu @ 2023-10-10 22:48 UTC (permalink / raw)
  To: linux-kernel, linux-hyperv; +Cc: kys, haiyangz, wei.liu, decui

Currently, the balloon floor value is automatically computed, but may be
too small depending on app usage of memory. This patch adds a balloon_floor
value as a module parameter that can be used to manually configure the
balloon floor value.

Signed-off-by: Angelina Vu <angelinavu@linux.microsoft.com>
---
 drivers/hv/hv_balloon.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 64ac5bdee3a6..87b312f99b2e 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -1101,6 +1101,10 @@ static void process_info(struct hv_dynmem_device *dm, struct dm_info_msg *msg)
 	}
 }
 
+unsigned long balloon_floor;
+module_param(balloon_floor, ulong, 0644);
+MODULE_PARM_DESC(balloon_floor, "Memory level (in megabytes) that ballooning will not remove");
+
 static unsigned long compute_balloon_floor(void)
 {
 	unsigned long min_pages;
@@ -1117,6 +1121,9 @@ static unsigned long compute_balloon_floor(void)
 	 *    8192       744    (1/16)
 	 *   32768      1512	(1/32)
 	 */
+	if (balloon_floor)
+		return MB2PAGES(balloon_floor);
+
 	if (nr_pages < MB2PAGES(128))
 		min_pages = MB2PAGES(8) + (nr_pages >> 1);
 	else if (nr_pages < MB2PAGES(512))
-- 
2.34.1


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

end of thread, other threads:[~2023-10-18  8:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 22:48 [PATCH] hv_balloon: Add module parameter to configure balloon floor value Angelina Vu
2023-10-10 23:16 ` Wei Liu
2023-10-14 20:28 ` kernel test robot
2023-10-17 14:41 ` Vitaly Kuznetsov
2023-10-17 17:19   ` Michael Kelley (LINUX)
2023-10-18  8:27     ` Vitaly Kuznetsov

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