]> www.infradead.org Git - users/willy/linux.git/commitdiff
xen: balloon: update the NR_BALLOON_PAGES state
authorNico Pache <npache@redhat.com>
Fri, 14 Mar 2025 21:37:57 +0000 (15:37 -0600)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 22 Mar 2025 05:03:13 +0000 (22:03 -0700)
Update the NR_BALLOON_PAGES counter when pages are added to or removed
from the Xen balloon.

Link: https://lkml.kernel.org/r/20250314213757.244258-5-npache@redhat.com
Signed-off-by: Nico Pache <npache@redhat.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Cc: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Juegren Gross <jgross@suse.com>
Cc: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/xen/balloon.c

index 163f7f1d70f1b17ad93575e4902004cfe9da5d4e..65d4e7fa1eb8df55ba62de4db68a70d9feec60a2 100644 (file)
@@ -157,6 +157,8 @@ static void balloon_append(struct page *page)
                list_add(&page->lru, &ballooned_pages);
                balloon_stats.balloon_low++;
        }
+       inc_node_page_state(page, NR_BALLOON_PAGES);
+
        wake_up(&balloon_wq);
 }
 
@@ -179,6 +181,8 @@ static struct page *balloon_retrieve(bool require_lowmem)
                balloon_stats.balloon_low--;
 
        __ClearPageOffline(page);
+       dec_node_page_state(page, NR_BALLOON_PAGES);
+
        return page;
 }