diff options
Diffstat (limited to 'include/linux/page_cgroup.h')
| -rw-r--r-- | include/linux/page_cgroup.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 13f126c89ae8..4b938d4f3ac2 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
| @@ -38,6 +38,7 @@ enum { | |||
| 38 | PCG_LOCK, /* page cgroup is locked */ | 38 | PCG_LOCK, /* page cgroup is locked */ |
| 39 | PCG_CACHE, /* charged as cache */ | 39 | PCG_CACHE, /* charged as cache */ |
| 40 | PCG_USED, /* this object is in use. */ | 40 | PCG_USED, /* this object is in use. */ |
| 41 | PCG_ACCT_LRU, /* page has been accounted for */ | ||
| 41 | }; | 42 | }; |
| 42 | 43 | ||
| 43 | #define TESTPCGFLAG(uname, lname) \ | 44 | #define TESTPCGFLAG(uname, lname) \ |
| @@ -52,11 +53,23 @@ static inline void SetPageCgroup##uname(struct page_cgroup *pc)\ | |||
| 52 | static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | 53 | static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ |
| 53 | { clear_bit(PCG_##lname, &pc->flags); } | 54 | { clear_bit(PCG_##lname, &pc->flags); } |
| 54 | 55 | ||
| 56 | #define TESTCLEARPCGFLAG(uname, lname) \ | ||
| 57 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | ||
| 58 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | ||
| 59 | |||
| 55 | /* Cache flag is set only once (at allocation) */ | 60 | /* Cache flag is set only once (at allocation) */ |
| 56 | TESTPCGFLAG(Cache, CACHE) | 61 | TESTPCGFLAG(Cache, CACHE) |
| 62 | CLEARPCGFLAG(Cache, CACHE) | ||
| 63 | SETPCGFLAG(Cache, CACHE) | ||
| 57 | 64 | ||
| 58 | TESTPCGFLAG(Used, USED) | 65 | TESTPCGFLAG(Used, USED) |
| 59 | CLEARPCGFLAG(Used, USED) | 66 | CLEARPCGFLAG(Used, USED) |
| 67 | SETPCGFLAG(Used, USED) | ||
| 68 | |||
| 69 | SETPCGFLAG(AcctLRU, ACCT_LRU) | ||
| 70 | CLEARPCGFLAG(AcctLRU, ACCT_LRU) | ||
| 71 | TESTPCGFLAG(AcctLRU, ACCT_LRU) | ||
| 72 | TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU) | ||
| 60 | 73 | ||
| 61 | static inline int page_cgroup_nid(struct page_cgroup *pc) | 74 | static inline int page_cgroup_nid(struct page_cgroup *pc) |
| 62 | { | 75 | { |
| @@ -105,14 +118,14 @@ static inline void __init page_cgroup_init_flatmem(void) | |||
| 105 | 118 | ||
| 106 | #endif | 119 | #endif |
| 107 | 120 | ||
| 108 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | ||
| 109 | #include <linux/swap.h> | 121 | #include <linux/swap.h> |
| 122 | |||
| 123 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | ||
| 110 | extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); | 124 | extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); |
| 111 | extern unsigned short lookup_swap_cgroup(swp_entry_t ent); | 125 | extern unsigned short lookup_swap_cgroup(swp_entry_t ent); |
| 112 | extern int swap_cgroup_swapon(int type, unsigned long max_pages); | 126 | extern int swap_cgroup_swapon(int type, unsigned long max_pages); |
| 113 | extern void swap_cgroup_swapoff(int type); | 127 | extern void swap_cgroup_swapoff(int type); |
| 114 | #else | 128 | #else |
| 115 | #include <linux/swap.h> | ||
| 116 | 129 | ||
| 117 | static inline | 130 | static inline |
| 118 | unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) | 131 | unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id) |
