1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/types.h>
6 #include <linux/mm_types.h>
10 extern u64 zswap_pool_total_size;
11 extern atomic_t zswap_stored_pages;
15 struct zswap_lruvec_state {
17 * Number of pages in zswap that should be protected from the shrinker.
18 * This number is an estimate of the following counts:
20 * a) Recent page faults.
21 * b) Recent insertion to the zswap LRU. This includes new zswap stores,
22 * as well as recent zswap LRU rotations.
24 * These pages are likely to be warm, and might incur IO if the are written
27 atomic_long_t nr_zswap_protected;
30 bool zswap_store(struct folio *folio);
31 bool zswap_load(struct folio *folio);
32 void zswap_invalidate(swp_entry_t swp);
33 int zswap_swapon(int type, unsigned long nr_pages);
34 void zswap_swapoff(int type);
35 void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg);
36 void zswap_lruvec_state_init(struct lruvec *lruvec);
37 void zswap_folio_swapin(struct folio *folio);
38 bool is_zswap_enabled(void);
41 struct zswap_lruvec_state {};
43 static inline bool zswap_store(struct folio *folio)
48 static inline bool zswap_load(struct folio *folio)
53 static inline void zswap_invalidate(swp_entry_t swp) {}
54 static inline int zswap_swapon(int type, unsigned long nr_pages)
58 static inline void zswap_swapoff(int type) {}
59 static inline void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg) {}
60 static inline void zswap_lruvec_state_init(struct lruvec *lruvec) {}
61 static inline void zswap_folio_swapin(struct folio *folio) {}
63 static inline bool is_zswap_enabled(void)
70 #endif /* _LINUX_ZSWAP_H */