diff --git a/drivers/hyperhold/Kconfig b/drivers/hyperhold/Kconfig index 8e5e7a1ee95734f9d3ffdc786afc484cf88f905a..4bba0efd1c3e7c50edb1f67152204814cf2892e2 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 f549137f71b0e06ba1a8d5a1f816acaf2aa51170..3a9768a358a8eb31666cfdf58f4efe10bd4e8263 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 6760018a1c8c27a684c134df1f0ee85f058cb2c3..df9bf9f4ade724db9a6e24b02cc44f59858fe30e 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 b5fcb0d2aa08417e7e788807d93f7265c29ddc3a..4bde41f21f93aa0ecd6fe738f663b40306a4f814 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 d7ea6a6fe2cb5f7bfc0e317738bc3eafa7570a31..d91a08b5ae2fe0374c1fe59aa4d1c8f49b61c080 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