From: Ma Wupeng mawupeng1@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S CVE: NA
--------------------------------
Export the mem_reliable_status(), so it can be used by others to check memory reliable's status.
Signed-off-by: Ma Wupeng mawupeng1@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com Reviewed-by: Kefeng Wangwangkefeng.wang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- include/linux/mem_reliable.h | 2 ++ mm/mem_reliable.c | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/include/linux/mem_reliable.h b/include/linux/mem_reliable.h index 8dbebabc8b289..3fd4364d8ae4b 100644 --- a/include/linux/mem_reliable.h +++ b/include/linux/mem_reliable.h @@ -34,6 +34,7 @@ extern void reliable_report_usage(struct seq_file *m, struct mm_struct *mm); extern void reliable_show_mem_info(void); extern void mem_reliable_out_of_memory(gfp_t gfp_mask, unsigned int order, int preferred_nid, nodemask_t *nodemask); +extern bool mem_reliable_status(void);
static inline bool mem_reliable_is_enabled(void) { @@ -137,6 +138,7 @@ static inline void shmem_reliable_page_counter(struct page *page, int nr_page) static inline void page_cache_fallback_inc(gfp_t gfp, struct page *page) {}
static inline bool pagecache_reliable_is_enabled(void) { return false; } +static inline bool mem_reliable_status(void) { return false; } #endif
#endif diff --git a/mm/mem_reliable.c b/mm/mem_reliable.c index cf53be97be5df..2501da40abf4a 100644 --- a/mm/mem_reliable.c +++ b/mm/mem_reliable.c @@ -32,6 +32,12 @@ struct percpu_counter reliable_shmem_used_nr_page __read_mostly; bool pagecache_use_reliable_mem __read_mostly = true; atomic_long_t page_cache_fallback = ATOMIC_LONG_INIT(0);
+bool mem_reliable_status(void) +{ + return mem_reliable_is_enabled(); +} +EXPORT_SYMBOL_GPL(mem_reliable_status); + void add_reliable_mem_size(long sz) { atomic_long_add(sz, &total_reliable_mem);