[Devel] [PATCH RH9 12/33] mm: Export swap_cache_info struct and variable

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Sep 23 22:08:15 MSK 2021


From: Kirill Tkhai <ktkhai at virtuozzo.com>

This will be used by vzstat.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

(cherry picked from vz8 commit 7f795f34eebf25d87c638a27ba0cb68d307f72de)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 include/linux/swap.h | 9 +++++++++
 mm/swap_state.c      | 8 ++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 6f5a432..9cf1402 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -761,5 +761,14 @@ static inline bool mem_cgroup_swap_full(struct page *page)
 }
 #endif
 
+struct swap_cache_info {
+	unsigned long add_total;
+	unsigned long del_total;
+	unsigned long find_success;
+	unsigned long find_total;
+};
+
+extern struct swap_cache_info swap_cache_info;
+
 #endif /* __KERNEL__*/
 #endif /* _LINUX_SWAP_H */
diff --git a/mm/swap_state.c b/mm/swap_state.c
index bc7cee6..504fed0 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -61,12 +61,8 @@
 #define INC_CACHE_INFO(x)	data_race(swap_cache_info.x++)
 #define ADD_CACHE_INFO(x, nr)	data_race(swap_cache_info.x += (nr))
 
-static struct {
-	unsigned long add_total;
-	unsigned long del_total;
-	unsigned long find_success;
-	unsigned long find_total;
-} swap_cache_info;
+struct swap_cache_info swap_cache_info;
+EXPORT_SYMBOL_GPL(swap_cache_info);
 
 static atomic_t swapin_readahead_hits = ATOMIC_INIT(4);
 
-- 
1.8.3.1



More information about the Devel mailing list