[Devel] [PATCH RHEL COMMIT] mm: Export swap_cache_info struct and variable

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 24 15:15:54 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 395ecddfb114a91f6da2764522418fad46152f95
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Sep 24 15:15:54 2021 +0300

    mm: Export swap_cache_info struct and variable
    
    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 6f5a43251593..9cf14021d01a 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 bc7cee6b2ec5..504fed0107da 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -61,12 +61,8 @@ static bool enable_vma_readahead __read_mostly = true;
 #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);
 


More information about the Devel mailing list