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: Kefeng Wang wangkefeng.wang@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 c3a9a4f21470..b75feac5e33c 100644 --- a/include/linux/mem_reliable.h +++ b/include/linux/mem_reliable.h @@ -21,6 +21,7 @@ extern void mem_reliable_init(bool has_unmirrored_mem, extern void shmem_reliable_init(void); extern void reliable_report_meminfo(struct seq_file *m); extern void page_cache_prepare_alloc(gfp_t *gfp); +extern bool mem_reliable_status(void);
static inline bool mem_reliable_is_enabled(void) { @@ -70,6 +71,7 @@ static inline bool skip_none_movable_zone(gfp_t gfp, struct zoneref *z) static inline void reliable_report_meminfo(struct seq_file *m) {} static inline bool shmem_reliable_is_enabled(void) { return false; } static inline void page_cache_prepare_alloc(gfp_t *gfp) {} +static inline bool mem_reliable_status(void) { return false; } #endif
#endif diff --git a/mm/mem_reliable.c b/mm/mem_reliable.c index 083997234e01..fe6f47a0b4cd 100644 --- a/mm/mem_reliable.c +++ b/mm/mem_reliable.c @@ -16,6 +16,12 @@ bool reliable_enabled; static atomic_long_t total_reliable_mem; bool shmem_reliable __read_mostly = true;
+bool mem_reliable_status(void) +{ + return mem_reliable_is_enabled(); +} +EXPORT_SYMBOL_GPL(mem_reliable_status); + void page_cache_prepare_alloc(gfp_t *gfp) { if (mem_reliable_is_enabled())