swap_cgroup.h 971 B

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