Linux 6.14-rc1
[linux.git] / include / linux / swap_cgroup.h
blobb5ec038069dab52accaf54cf3d6abde49c1656cc
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_SWAP_CGROUP_H
3 #define __LINUX_SWAP_CGROUP_H
5 #include <linux/swap.h>
7 #if defined(CONFIG_MEMCG) && defined(CONFIG_SWAP)
9 extern void swap_cgroup_record(struct folio *folio, swp_entry_t ent);
10 extern unsigned short swap_cgroup_clear(swp_entry_t ent, unsigned int nr_ents);
11 extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
12 extern int swap_cgroup_swapon(int type, unsigned long max_pages);
13 extern void swap_cgroup_swapoff(int type);
15 #else
17 static inline
18 void swap_cgroup_record(struct folio *folio, swp_entry_t ent)
22 static inline
23 unsigned short swap_cgroup_clear(swp_entry_t ent, unsigned int nr_ents)
25 return 0;
28 static inline
29 unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
31 return 0;
34 static inline int
35 swap_cgroup_swapon(int type, unsigned long max_pages)
37 return 0;
40 static inline void swap_cgroup_swapoff(int type)
42 return;
45 #endif
47 #endif /* __LINUX_SWAP_CGROUP_H */