xref: /openbmc/linux/include/linux/swap_cgroup.h (revision e55b9f96)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
25d1ea48bSJohannes Weiner #ifndef __LINUX_SWAP_CGROUP_H
35d1ea48bSJohannes Weiner #define __LINUX_SWAP_CGROUP_H
45d1ea48bSJohannes Weiner 
55d1ea48bSJohannes Weiner #include <linux/swap.h>
65d1ea48bSJohannes Weiner 
7*e55b9f96SJohannes Weiner #if defined(CONFIG_MEMCG) && defined(CONFIG_SWAP)
85d1ea48bSJohannes Weiner 
95d1ea48bSJohannes Weiner extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
105d1ea48bSJohannes Weiner 					unsigned short old, unsigned short new);
1138d8b4e6SHuang Ying extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
1238d8b4e6SHuang Ying 					 unsigned int nr_ents);
135d1ea48bSJohannes Weiner extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
145d1ea48bSJohannes Weiner extern int swap_cgroup_swapon(int type, unsigned long max_pages);
155d1ea48bSJohannes Weiner extern void swap_cgroup_swapoff(int type);
165d1ea48bSJohannes Weiner 
175d1ea48bSJohannes Weiner #else
185d1ea48bSJohannes Weiner 
195d1ea48bSJohannes Weiner static inline
swap_cgroup_record(swp_entry_t ent,unsigned short id,unsigned int nr_ents)2038d8b4e6SHuang Ying unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
2138d8b4e6SHuang Ying 				  unsigned int nr_ents)
225d1ea48bSJohannes Weiner {
235d1ea48bSJohannes Weiner 	return 0;
245d1ea48bSJohannes Weiner }
255d1ea48bSJohannes Weiner 
265d1ea48bSJohannes Weiner static inline
lookup_swap_cgroup_id(swp_entry_t ent)275d1ea48bSJohannes Weiner unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
285d1ea48bSJohannes Weiner {
295d1ea48bSJohannes Weiner 	return 0;
305d1ea48bSJohannes Weiner }
315d1ea48bSJohannes Weiner 
325d1ea48bSJohannes Weiner static inline int
swap_cgroup_swapon(int type,unsigned long max_pages)335d1ea48bSJohannes Weiner swap_cgroup_swapon(int type, unsigned long max_pages)
345d1ea48bSJohannes Weiner {
355d1ea48bSJohannes Weiner 	return 0;
365d1ea48bSJohannes Weiner }
375d1ea48bSJohannes Weiner 
swap_cgroup_swapoff(int type)385d1ea48bSJohannes Weiner static inline void swap_cgroup_swapoff(int type)
395d1ea48bSJohannes Weiner {
405d1ea48bSJohannes Weiner 	return;
415d1ea48bSJohannes Weiner }
425d1ea48bSJohannes Weiner 
43*e55b9f96SJohannes Weiner #endif
445d1ea48bSJohannes Weiner 
455d1ea48bSJohannes Weiner #endif /* __LINUX_SWAP_CGROUP_H */
46