lkml.org 
[lkml]   [2022]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v5 2/8] mm: Enable balloon drivers to report inflated memory
Date
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(+)

diff --git a/include/linux/balloon.h b/include/linux/balloon.h
index 46ac8f61f607..dd8fb8ac5737 100644
--- a/include/linux/balloon.h
+++ b/include/linux/balloon.h
@@ -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);
diff --git a/mm/balloon.c b/mm/balloon.c
index 22b3e876bc78..59f606bf4390 100644
--- a/mm/balloon.c
+++ b/mm/balloon.c
@@ -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)
{
--
2.31.1
\
 
 \ /
  Last update: 2022-10-19 13:31    [W:0.035 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site