aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/page_cgroup.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/page_cgroup.h')
-rw-r--r--include/linux/page_cgroup.h15
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) \
57static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ 58static 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
61TESTPCGFLAG(Locked, LOCK)
62
60/* Cache flag is set only once (at allocation) */ 63/* Cache flag is set only once (at allocation) */
61TESTPCGFLAG(Cache, CACHE) 64TESTPCGFLAG(Cache, CACHE)
62CLEARPCGFLAG(Cache, CACHE) 65CLEARPCGFLAG(Cache, CACHE)
@@ -71,6 +74,11 @@ CLEARPCGFLAG(AcctLRU, ACCT_LRU)
71TESTPCGFLAG(AcctLRU, ACCT_LRU) 74TESTPCGFLAG(AcctLRU, ACCT_LRU)
72TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU) 75TESTCLEARPCGFLAG(AcctLRU, ACCT_LRU)
73 76
77
78SETPCGFLAG(FileMapped, FILE_MAPPED)
79CLEARPCGFLAG(FileMapped, FILE_MAPPED)
80TESTPCGFLAG(FileMapped, FILE_MAPPED)
81
74static inline int page_cgroup_nid(struct page_cgroup *pc) 82static 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
89static inline int trylock_page_cgroup(struct page_cgroup *pc)
90{
91 return bit_spin_trylock(PCG_LOCK, &pc->flags);
92}
93
94static inline void unlock_page_cgroup(struct page_cgroup *pc) 97static 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
127extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
128 unsigned short old, unsigned short new);
124extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id); 129extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id);
125extern unsigned short lookup_swap_cgroup(swp_entry_t ent); 130extern unsigned short lookup_swap_cgroup(swp_entry_t ent);
126extern int swap_cgroup_swapon(int type, unsigned long max_pages); 131extern int swap_cgroup_swapon(int type, unsigned long max_pages);