From acceb4fb840423fdcb37a5943b04d6f10d5ebae0 Mon Sep 17 00:00:00 2001 From: CY Fan Date: Tue, 15 Feb 2022 16:18:32 +0800 Subject: [PATCH] hyperhold: fix the compiler warnings when hyperhold configs are closed ohos inclusion category: bugfix issue: #I4TSO9 CVE: NA ----------------- This patch fixes the compilers warnings by modifying configs and functions dependencies Signed-off-by: CY Fan --- drivers/hyperhold/Kconfig | 2 ++ include/linux/zswapd.h | 58 ++------------------------------------- mm/Kconfig | 2 +- mm/zswapd.c | 2 ++ mm/zswapd_control.c | 1 + 5 files changed, 9 insertions(+), 56 deletions(-) diff --git a/drivers/hyperhold/Kconfig b/drivers/hyperhold/Kconfig index 8e5e7a1ee957..4bba0efd1c3e 100644 --- a/drivers/hyperhold/Kconfig +++ b/drivers/hyperhold/Kconfig @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 config HYPERHOLD bool "Hyperhold driver" + select HYPERHOLD_ZSWAPD + select HYPERHOLD_MEMCG default n help Hyperhold driver. diff --git a/include/linux/zswapd.h b/include/linux/zswapd.h index f549137f71b0..3a9768a358a8 100644 --- a/include/linux/zswapd.h +++ b/include/linux/zswapd.h @@ -34,8 +34,6 @@ struct group_swap_device { #ifdef CONFIG_HYPERHOLD_ZSWAPD extern int zswapd_run(int nid); extern void zswapd_stop(int nid); -extern void wakeup_zswapd(pg_data_t *pgdat); -extern bool zram_watermark_ok(void); extern void zswapd_status_show(struct seq_file *m); extern void wake_all_zswapd(void); extern void set_snapshotd_init_flag(unsigned int val); @@ -43,60 +41,10 @@ extern pid_t get_zswapd_pid(void); extern unsigned long long get_free_swap_threshold(void); extern struct group_swap_device *register_group_swap(struct group_swap_ops *ops, void *priv); extern void unregister_group_swap(struct group_swap_device *gsdev); -extern void memcg_eswap_info_show(struct seq_file *m); -#else -static inline int zswap_run(int nid) -{ - return 0; -} - -static inline void zswapd_stop(int nid) -{ -} - -static inline void wakeup_zswapd(pg_data_t *pgdat) -{ -} - -static inline bool zram_watermark_ok(void) -{ - return true; -} - -static inline void zswapd_status_show(struct seq_file *m) -{ -} - -static inline void wake_all_zswapd(void) -{ -} - -static inline void set_snapshotd_init_flag(unsigned int val) -{ -} -static inline pid_t get_zswapd_pid(void) -{ - return -EINVAL; -} - -static inline u64 get_free_swap_threshold(void) -{ - return 0; -} - -static struct group_swap_device *register_group_swap(struct group_swap_ops *ops, void *priv) -{ - return NULL; -} - -static void unregister_group_swap(struct group_swap_device *gsdev) -{ -} - -static void memcg_eswap_info_show(struct seq_file *m) -{ -} +#ifdef CONFIG_HYPERHOLD_DEBUG +extern void memcg_eswap_info_show(struct seq_file *m); +#endif #endif #endif /* _LINUX_ZSWAPD_H */ diff --git a/mm/Kconfig b/mm/Kconfig index 6760018a1c8c..df9bf9f4ade7 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -82,7 +82,7 @@ config HYPERHOLD_MEMCG config HYPERHOLD_ZSWAPD bool "Enable zswapd thread to reclaim anon pages in background" - depends on HYPERHOLD + depends on HYPERHOLD && ZRAM default n help zswapd is a kernel thread that reclaim anonymous pages in the diff --git a/mm/zswapd.c b/mm/zswapd.c index b5fcb0d2aa08..4bde41f21f93 100644 --- a/mm/zswapd.c +++ b/mm/zswapd.c @@ -473,6 +473,7 @@ void wake_all_zswapd(void) } } +#ifdef CONFIG_HYPERHOLD_FILE_LRU static void zswapd_shrink_active_list(unsigned long nr_to_scan, struct lruvec *lruvec, struct scan_control *sc, enum lru_list lru) { @@ -565,6 +566,7 @@ static void zswapd_shrink_anon_memcg(struct pglist_data *pgdat, blk_finish_plug(&plug); sc->nr_reclaimed += nr_reclaimed; } +#endif static bool zswapd_shrink_anon(pg_data_t *pgdat, struct scan_control *sc) { diff --git a/mm/zswapd_control.c b/mm/zswapd_control.c index d7ea6a6fe2cb..d91a08b5ae2f 100644 --- a/mm/zswapd_control.c +++ b/mm/zswapd_control.c @@ -630,6 +630,7 @@ static int compress_ratio_show(struct seq_file *m, void *v) return 0; } + static int zswapd_vmstat_show(struct seq_file *m, void *v) { #ifdef CONFIG_VM_EVENT_COUNTERS -- Gitee