From 4506bcbba5ec78d8d694fbb43e964cfefe900887 Mon Sep 17 00:00:00 2001 From: Bing Han Date: Fri, 10 Jun 2022 19:29:05 +0800 Subject: [PATCH] ANDROID: mm: export swap_type_to_swap_info The function swap_type_to_swap_info is exported to access the swap_info_struct of the specified swap, which is regarded as reserved extended memory. Bug: 234214858 Signed-off-by: Bing Han Change-Id: I0107e7d561150f1945a4c161e886e9e03383fff6 --- mm/swapfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 2bf47ed376cb..3deff9d469e5 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -99,7 +99,7 @@ static atomic_t proc_poll_event = ATOMIC_INIT(0); atomic_t nr_rotate_swap = ATOMIC_INIT(0); -static struct swap_info_struct *swap_type_to_swap_info(int type) +struct swap_info_struct *swap_type_to_swap_info(int type) { if (type >= READ_ONCE(nr_swapfiles)) return NULL; @@ -107,6 +107,7 @@ static struct swap_info_struct *swap_type_to_swap_info(int type) smp_rmb(); /* Pairs with smp_wmb in alloc_swap_info. */ return READ_ONCE(swap_info[type]); } +EXPORT_SYMBOL_GPL(swap_type_to_swap_info); static inline unsigned char swap_count(unsigned char ent) {