Contributors: 17
Author Tokens Token Proportion Commits Commit Proportion
Johannes Weiner 93 35.77% 5 16.13%
Nhat Pham 44 16.92% 4 12.90%
Matthew Wilcox 26 10.00% 4 12.90%
Chengming Zhou 17 6.54% 3 9.68%
Konstantin Khlebnikov 13 5.00% 1 3.23%
Anton Vorontsov 13 5.00% 1 3.23%
Yosry Ahmed 10 3.85% 2 6.45%
Andrew Morton 8 3.08% 1 3.23%
Domenico Cerasuolo 8 3.08% 1 3.23%
Liu Shixin 8 3.08% 1 3.23%
Seth Jennings 6 2.31% 1 3.23%
Yu Zhao 5 1.92% 2 6.45%
Huang Ying 4 1.54% 1 3.23%
Dan Magenheimer 2 0.77% 1 3.23%
Barry Song 1 0.38% 1 3.23%
Greg Kroah-Hartman 1 0.38% 1 3.23%
Kanchana P Sridhar 1 0.38% 1 3.23%
Total 260 31


/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_ZSWAP_H
#define _LINUX_ZSWAP_H

#include <linux/types.h>
#include <linux/mm_types.h>

struct lruvec;

extern atomic_long_t zswap_stored_pages;

#ifdef CONFIG_ZSWAP

struct zswap_lruvec_state {
	/*
	 * Number of swapped in pages from disk, i.e not found in the zswap pool.
	 *
	 * This is consumed and subtracted from the lru size in
	 * zswap_shrinker_count() to penalize past overshrinking that led to disk
	 * swapins. The idea is that had we considered this many more pages in the
	 * LRU active/protected and not written them back, we would not have had to
	 * swapped them in.
	 */
	atomic_long_t nr_disk_swapins;
};

unsigned long zswap_total_pages(void);
bool zswap_store(struct folio *folio);
int zswap_load(struct folio *folio);
void zswap_invalidate(swp_entry_t swp);
int zswap_swapon(int type, unsigned long nr_pages);
void zswap_swapoff(int type);
void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg);
void zswap_lruvec_state_init(struct lruvec *lruvec);
void zswap_folio_swapin(struct folio *folio);
bool zswap_is_enabled(void);
bool zswap_never_enabled(void);
#else

struct zswap_lruvec_state {};

static inline bool zswap_store(struct folio *folio)
{
	return false;
}

static inline int zswap_load(struct folio *folio)
{
	return -ENOENT;
}

static inline void zswap_invalidate(swp_entry_t swp) {}
static inline int zswap_swapon(int type, unsigned long nr_pages)
{
	return 0;
}
static inline void zswap_swapoff(int type) {}
static inline void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg) {}
static inline void zswap_lruvec_state_init(struct lruvec *lruvec) {}
static inline void zswap_folio_swapin(struct folio *folio) {}

static inline bool zswap_is_enabled(void)
{
	return false;
}

static inline bool zswap_never_enabled(void)
{
	return true;
}

#endif

#endif /* _LINUX_ZSWAP_H */