blob: 145306bdc92f59e0b97c8a59bba4cdd2009f29ea [file] [log] [blame]
Johannes Weiner5d1ea482014-12-10 15:44:55 -08001#ifndef __LINUX_SWAP_CGROUP_H
2#define __LINUX_SWAP_CGROUP_H
KAMEZAWA Hiroyuki52d4b9a2008-10-18 20:28:16 -07003
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -08004#include <linux/swap.h>
Jaswinder Singh Rajput97572752009-09-20 16:20:44 +05305
Andrew Mortonc255a452012-07-31 16:43:02 -07006#ifdef CONFIG_MEMCG_SWAP
Johannes Weiner5d1ea482014-12-10 15:44:55 -08007
Daisuke Nishimura02491442010-03-10 15:22:17 -08008extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
9 unsigned short old, unsigned short new);
KAMEZAWA Hiroyukia3b2d692009-04-02 16:57:45 -070010extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
Bob Liu9fb4b7c2012-01-12 17:18:48 -080011extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080012extern int swap_cgroup_swapon(int type, unsigned long max_pages);
13extern void swap_cgroup_swapoff(int type);
Johannes Weiner5d1ea482014-12-10 15:44:55 -080014
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080015#else
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080016
17static inline
KAMEZAWA Hiroyukia3b2d692009-04-02 16:57:45 -070018unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id)
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080019{
KAMEZAWA Hiroyukia3b2d692009-04-02 16:57:45 -070020 return 0;
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080021}
22
23static inline
Bob Liu9fb4b7c2012-01-12 17:18:48 -080024unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080025{
KAMEZAWA Hiroyukia3b2d692009-04-02 16:57:45 -070026 return 0;
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080027}
28
29static inline int
30swap_cgroup_swapon(int type, unsigned long max_pages)
31{
32 return 0;
33}
34
35static inline void swap_cgroup_swapoff(int type)
36{
37 return;
38}
39
Andrew Mortonc255a452012-07-31 16:43:02 -070040#endif /* CONFIG_MEMCG_SWAP */
Johannes Weiner6b3ae582011-03-23 16:42:30 -070041
Johannes Weiner5d1ea482014-12-10 15:44:55 -080042#endif /* __LINUX_SWAP_CGROUP_H */