vmw_balloon keeps 2 MiB balloon-inflated pages on its own list, not
using balloon core that takes otherwise care of updating NR_BALLOON_PAGES
for base pages.

So far we didn't account 2 MiB pages under the "Balloon" counters, so
/proc/meminfo etc. would not reflect them.

Fix it by updating NR_BALLOON_PAGES when enqueuing and dequeuing for
these pages manually.

This has low urgency.

Fixes: 4d689474e1b2 ("balloon_compaction: update the NR_BALLOON_PAGES state")
Cc: [email protected]
Signed-off-by: David Hildenbrand (Arm) <[email protected]>
---
 drivers/misc/vmw_balloon.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 3edb934dd7fd5..47dbcb3be6ed6 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1005,6 +1005,8 @@ static void vmballoon_enqueue_page_list(struct vmballoon 
*b,
 
                list_for_each_entry(page, pages, lru) {
                        vmballoon_mark_page_offline(page, VMW_BALLOON_2M_PAGE);
+                       mod_node_page_state(page_pgdat(page), NR_BALLOON_PAGES,
+                                           1 << VMW_BALLOON_2M_ORDER);
                }
 
                list_splice_init(pages, &b->huge_pages);
@@ -1049,6 +1051,8 @@ static void vmballoon_dequeue_page_list(struct vmballoon 
*b,
        spin_lock(&b->huge_pages_lock);
        list_for_each_entry_safe(page, tmp, &b->huge_pages, lru) {
                vmballoon_mark_page_online(page, VMW_BALLOON_2M_PAGE);
+               mod_node_page_state(page_pgdat(page), NR_BALLOON_PAGES,
+                                   -(1 << VMW_BALLOON_2M_ORDER));
 
                list_move(&page->lru, pages);
                if (++i == n_req_pages)

-- 
2.56.1


Reply via email to