[RFC,v5,2/8] mm: Enable balloon drivers to report inflated memory
Commit Message
Add counters to be updated by the balloon drivers.
Signed-off-by: Alexander Atanasov <alexander.atanasov@virtuozzo.com>
---
include/linux/balloon.h | 6 ++++++
mm/balloon.c | 15 +++++++++++++++
2 files changed, 21 insertions(+)
@@ -57,6 +57,12 @@ struct balloon_dev_info {
struct page *page, enum migrate_mode mode);
};
+extern atomic_long_t mem_balloon_inflated_total_kb;
+extern atomic_long_t mem_balloon_inflated_free_kb;
+
+void balloon_set_inflated_total(long inflated_kb);
+void balloon_set_inflated_free(long inflated_kb);
+
struct page *balloon_page_alloc(void);
void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
struct page *page);
@@ -9,6 +9,21 @@
#include <linux/export.h>
#include <linux/balloon.h>
+atomic_long_t mem_balloon_inflated_total_kb = ATOMIC_LONG_INIT(0);
+atomic_long_t mem_balloon_inflated_free_kb = ATOMIC_LONG_INIT(0);
+
+void balloon_set_inflated_total(long inflated_kb)
+{
+ atomic_long_set(&mem_balloon_inflated_total_kb, inflated_kb);
+}
+EXPORT_SYMBOL(balloon_set_inflated_total);
+
+void balloon_set_inflated_free(long inflated_kb)
+{
+ atomic_long_set(&mem_balloon_inflated_free_kb, inflated_kb);
+}
+EXPORT_SYMBOL(balloon_set_inflated_free);
+
static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
struct page *page)
{