hv_balloon: Fix committed value in post_status() if dynamic memory is disabled
Subsystems (2)
PATCH 1/1 hv_balloon: Fix committed value in post_status() if dynamic memory is disabled
If Dynamic memory is disabled for VM, the committed value reported by the post_status() call by hv_balloon driver includes compute_balloon_floor(). This is not needed if balloon_up operations or hot_add operations were never requested on the VM(or if Dynamic memory was disabled for the VM)
--- drivers/hv/hv_balloon.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/hv/hv_balloon.c +17 -5
@@ -1129,11 +1129,23 @@ static unsigned long compute_balloon_floor(void)static unsigned long get_pages_committed (struct hv_dynmem_device *dm) { -return vm_memory_committed () + - dm->num_pages_ballooned + - (dm->num_pages_added > dm->num_pages_onlined ? - dm->num_pages_added - dm->num_pages_onlined :0 ) + -compute_balloon_floor (); +unsigned long pages_committed; + + pages_committed =vm_memory_committed (); + +/* +* If no balloon_up or hot_add operation was performed do not add +* num_pages_ballooned, number of pages offline or +* compute_balloon_floor() to the pages_committed value +*/ +if (dm->num_pages_ballooned || dm->num_pages_added) { + pages_committed += dm->num_pages_ballooned + + (dm->num_pages_added > dm->num_pages_onlined ? + dm->num_pages_added - dm->num_pages_onlined :0 ) + +compute_balloon_floor (); + } + +return pages_committed; }/*
Signature · 1 line
2.37.2
Wei Liu
maintainerQuoted 6 lines · Shradha Gupta
If Dynamic memory is disabled for VM, the committed value reported by the
post_status()call byhv_balloondriver includescompute_balloon_floor(). This is not needed ifballoon_upoperations orhot_addoperations were never requested on the VM(or if Dynamic memory was disabled for the VM)Signed-off-by Shradha Gupta <[email protected]>
Can you put a Fixes: tag here?
You can use git-blame to find out the culprit.
Thanks,
Wei.
Quoted 40 lines
--- drivers/hv/hv_balloon.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)drivers/hv/hv_balloon.c +17
-5@@ -1129,11 +1129,23 @@ static unsigned long compute_balloon_floor(void)static unsigned long get_pages_committed (struct hv_dynmem_device *dm) { -return vm_memory_committed () + - dm->num_pages_ballooned + - (dm->num_pages_added > dm->num_pages_onlined ? - dm->num_pages_added - dm->num_pages_onlined :0 ) + -compute_balloon_floor (); +unsigned long pages_committed; + + pages_committed =vm_memory_committed (); + +/* +* If no balloon_up or hot_add operation was performed do not add +* num_pages_ballooned, number of pages offline or +* compute_balloon_floor() to the pages_committed value +*/ +if (dm->num_pages_ballooned || dm->num_pages_added) { + pages_committed += dm->num_pages_ballooned + + (dm->num_pages_added > dm->num_pages_onlined ? + dm->num_pages_added - dm->num_pages_onlined :0 ) + +compute_balloon_floor (); + } + +return pages_committed; }/* Signature · 1 line
2.37.2