Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __LINUX_SWAP_CGROUP_H
0003 #define __LINUX_SWAP_CGROUP_H
0004 
0005 #include <linux/swap.h>
0006 
0007 #ifdef CONFIG_MEMCG_SWAP
0008 
0009 extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
0010                     unsigned short old, unsigned short new);
0011 extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
0012                      unsigned int nr_ents);
0013 extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
0014 extern int swap_cgroup_swapon(int type, unsigned long max_pages);
0015 extern void swap_cgroup_swapoff(int type);
0016 
0017 #else
0018 
0019 static inline
0020 unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
0021                   unsigned int nr_ents)
0022 {
0023     return 0;
0024 }
0025 
0026 static inline
0027 unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
0028 {
0029     return 0;
0030 }
0031 
0032 static inline int
0033 swap_cgroup_swapon(int type, unsigned long max_pages)
0034 {
0035     return 0;
0036 }
0037 
0038 static inline void swap_cgroup_swapoff(int type)
0039 {
0040     return;
0041 }
0042 
0043 #endif /* CONFIG_MEMCG_SWAP */
0044 
0045 #endif /* __LINUX_SWAP_CGROUP_H */