include/linux/zswap.h
Source file repositories/reference/linux-study-clean/include/linux/zswap.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/zswap.h- Extension
.h- Size
- 1868 bytes
- Lines
- 75
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/mm_types.h
Detected Declarations
struct lruvecstruct zswap_lruvec_statestruct zswap_lruvec_statefunction zswap_storefunction zswap_loadfunction zswap_invalidatefunction zswap_swapofffunction zswap_never_enabled
Annotated Snippet
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 */
Annotation
- Immediate include surface: `linux/types.h`, `linux/mm_types.h`.
- Detected declarations: `struct lruvec`, `struct zswap_lruvec_state`, `struct zswap_lruvec_state`, `function zswap_store`, `function zswap_load`, `function zswap_invalidate`, `function zswap_swapoff`, `function zswap_never_enabled`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.