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 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); 14 15 #else 16 17 static inline 18 void swap_cgroup_record(struct folio *folio, swp_entry_t ent) 19 { 20 } 21 22 static inline 23 unsigned short swap_cgroup_clear(swp_entry_t ent, unsigned int nr_ents) 24 { 25 return 0; 26 } 27 28 static inline 29 unsigned short lookup_swap_cgroup_id(swp_entry_t ent) 30 { 31 return 0; 32 } 33 34 static inline int 35 swap_cgroup_swapon(int type, unsigned long max_pages) 36 { 37 return 0; 38 } 39 40 static inline void swap_cgroup_swapoff(int type) 41 { 42 return; 43 } 44 45 #endif 46 47 #endif /* __LINUX_SWAP_CGROUP_H */ 48