diff options
Diffstat (limited to 'include/linux/page_cgroup.h')
-rw-r--r-- | include/linux/page_cgroup.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index 4b938d4f3ac2..aef22ae2af47 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
@@ -39,6 +39,7 @@ enum { | |||
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 | PCG_ACCT_LRU, /* page has been accounted for */ |
42 | PCG_FILE_MAPPED, /* page is accounted as "mapped" */ | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | #define TESTPCGFLAG(uname, lname) \ | 45 | #define TESTPCGFLAG(uname, lname) \ |
@@ -57,6 +58,8 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
57 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 58 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
58 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 59 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
59 | 60 | ||
61 | TESTPCGFLAG(Locked, LOCK) | ||
62 | |||
60 | /* Cache flag is set only once (at allocation) */ | 63 | /* Cache flag is set only once (at allocation) */ |
61 | TESTPCGFLAG(Cache, CACHE) | 64 | TESTPCGFLAG(Cache, CACHE) |
62 | CLEARPCGFLAG(Cache, CACHE) | 65 | CLEARPCGFLAG(Cache, CACHE) |
@@ -71,6 +74,11 @@ CLEARPCGFLAG(AcctLRU, ACCT_LRU) | |||
71 | TESTPCGFLAG(AcctLRU, ACCT_LRU) | 74 | TESTPCGFLAG(AcctLRU, ACCT_LRU) |
72 | TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU) | 75 | TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU) |
73 | 76 | ||
77 | |||
78 | SETPCGFLAG(FileMapped, FILE_MAPPED) | ||
79 | CLEARPCGFLAG(FileMapped, FILE_MAPPED) | ||
80 | TESTPCGFLAG(FileMapped, FILE_MAPPED) | ||
81 | |||
74 | static inline int page_cgroup_nid(struct page_cgroup *pc) | 82 | static inline int page_cgroup_nid(struct page_cgroup *pc) |
75 | { | 83 | { |
76 | return page_to_nid(pc->page); | 84 | return page_to_nid(pc->page); |
@@ -86,11 +94,6 @@ static inline void lock_page_cgroup(struct page_cgroup *pc) | |||
86 | bit_spin_lock(PCG_LOCK, &pc->flags); | 94 | bit_spin_lock(PCG_LOCK, &pc->flags); |
87 | } | 95 | } |
88 | 96 | ||
89 | static inline int trylock_page_cgroup(struct page_cgroup *pc) | ||
90 | { | ||
91 | return bit_spin_trylock(PCG_LOCK, &pc->flags); | ||
92 | } | ||
93 | |||
94 | static inline void unlock_page_cgroup(struct page_cgroup *pc) | 97 | static inline void unlock_page_cgroup(struct page_cgroup *pc) |
95 | { | 98 | { |
96 | bit_spin_unlock(PCG_LOCK, &pc->flags); | 99 | bit_spin_unlock(PCG_LOCK, &pc->flags); |
@@ -121,6 +124,8 @@ static inline void __init page_cgroup_init_flatmem(void) | |||
121 | #include <linux/swap.h> | 124 | #include <linux/swap.h> |
122 | 125 | ||
123 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP | 126 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP |
127 | extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, | ||
128 | unsigned short old, unsigned short new); | ||
124 | extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); | 129 | extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); |
125 | extern unsigned short lookup_swap_cgroup(swp_entry_t ent); | 130 | extern unsigned short lookup_swap_cgroup(swp_entry_t ent); |
126 | extern int swap_cgroup_swapon(int type, unsigned long max_pages); | 131 | extern int swap_cgroup_swapon(int type, unsigned long max_pages); |