srcu: Use try-lock lockdep annotation for NMI-safe access.
[platform/kernel/linux-starfive.git] / include / linux / swap_cgroup.h
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 #if defined(CONFIG_MEMCG) && defined(CONFIG_SWAP)
8
9 extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
10                                         unsigned short old, unsigned short new);
11 extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
12                                          unsigned int nr_ents);
13 extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
14 extern int swap_cgroup_swapon(int type, unsigned long max_pages);
15 extern void swap_cgroup_swapoff(int type);
16
17 #else
18
19 static inline
20 unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
21                                   unsigned int nr_ents)
22 {
23         return 0;
24 }
25
26 static inline
27 unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
28 {
29         return 0;
30 }
31
32 static inline int
33 swap_cgroup_swapon(int type, unsigned long max_pages)
34 {
35         return 0;
36 }
37
38 static inline void swap_cgroup_swapoff(int type)
39 {
40         return;
41 }
42
43 #endif
44
45 #endif /* __LINUX_SWAP_CGROUP_H */