aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2013-02-08 18:57:15 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-08 18:42:01 -0500
commite500d158fb07794724f12655f2eb5702fec613c4 (patch)
tree063ae9f082e012f98ecf7773e83f2d7f3f36b292 /drivers/hv
parente1e0a9e6991ec2c611f13dfc0a6bc1a214a22374 (diff)
Drivers: hv: balloon: Add a parameter to delay pressure reporting
Delay reporting memory pressure by a specified amount of time. This addresses the problem where the host may take memory balancing decisions based on incorrect memory pressure data that will be posted as soon as the balloon driver is loaded. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r--drivers/hv/hv_balloon.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 32a96f164dc8..f8fc99600de8 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -414,10 +414,17 @@ struct dm_info_msg {
414 414
415static bool hot_add; 415static bool hot_add;
416static bool do_hot_add; 416static bool do_hot_add;
417/*
418 * Delay reporting memory pressure by
419 * the specified number of seconds.
420 */
421static uint pressure_report_delay = 30;
417 422
418module_param(hot_add, bool, (S_IRUGO | S_IWUSR)); 423module_param(hot_add, bool, (S_IRUGO | S_IWUSR));
419MODULE_PARM_DESC(hot_add, "If set attempt memory hot_add"); 424MODULE_PARM_DESC(hot_add, "If set attempt memory hot_add");
420 425
426module_param(pressure_report_delay, uint, (S_IRUGO | S_IWUSR));
427MODULE_PARM_DESC(pressure_report_delay, "Delay in secs in reporting pressure");
421static atomic_t trans_id = ATOMIC_INIT(0); 428static atomic_t trans_id = ATOMIC_INIT(0);
422 429
423static int dm_ring_size = (5 * PAGE_SIZE); 430static int dm_ring_size = (5 * PAGE_SIZE);
@@ -531,6 +538,10 @@ static void post_status(struct hv_dynmem_device *dm)
531 struct dm_status status; 538 struct dm_status status;
532 struct sysinfo val; 539 struct sysinfo val;
533 540
541 if (pressure_report_delay > 0) {
542 --pressure_report_delay;
543 return;
544 }
534 si_meminfo(&val); 545 si_meminfo(&val);
535 memset(&status, 0, sizeof(struct dm_status)); 546 memset(&status, 0, sizeof(struct dm_status));
536 status.hdr.type = DM_STATUS_REPORT; 547 status.hdr.type = DM_STATUS_REPORT;
@@ -552,8 +563,6 @@ static void post_status(struct hv_dynmem_device *dm)
552 563
553} 564}
554 565
555
556
557static void free_balloon_pages(struct hv_dynmem_device *dm, 566static void free_balloon_pages(struct hv_dynmem_device *dm,
558 union dm_mem_page_range *range_array) 567 union dm_mem_page_range *range_array)
559{ 568{