1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_SWAP_CGROUP_H
3#define __LINUX_SWAP_CGROUP_H
4
5#include <linux/swap.h>
6
7#ifdef CONFIG_MEMCG_SWAP
8
9extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
10 unsigned short old, unsigned short new);
11extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
12 unsigned int nr_ents);
13extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
14extern int swap_cgroup_swapon(int type, unsigned long max_pages);
15extern void swap_cgroup_swapoff(int type);
16
17#else
18
19static inline
20unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
21 unsigned int nr_ents)
22{
23 return 0;
24}
25
26static inline
27unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
28{
29 return 0;
30}
31
32static inline int
33swap_cgroup_swapon(int type, unsigned long max_pages)
34{
35 return 0;
36}
37
38static inline void swap_cgroup_swapoff(int type)
39{
40 return;
41}
42
43#endif /* CONFIG_MEMCG_SWAP */
44
45#endif /* __LINUX_SWAP_CGROUP_H */
46