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.h33
1 files changed, 1 insertions, 32 deletions
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index a2d11771c84b..a88cdba27809 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -4,12 +4,8 @@
4enum { 4enum {
5 /* flags for mem_cgroup */ 5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */ 6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
7 PCG_CACHE, /* charged as cache */
8 PCG_USED, /* this object is in use. */ 7 PCG_USED, /* this object is in use. */
9 PCG_MIGRATION, /* under page migration */ 8 PCG_MIGRATION, /* under page migration */
10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 __NR_PCG_FLAGS, 9 __NR_PCG_FLAGS,
14}; 10};
15 11
@@ -64,19 +60,10 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
64static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ 60static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
65 { return test_and_clear_bit(PCG_##lname, &pc->flags); } 61 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
66 62
67/* Cache flag is set only once (at allocation) */
68TESTPCGFLAG(Cache, CACHE)
69CLEARPCGFLAG(Cache, CACHE)
70SETPCGFLAG(Cache, CACHE)
71
72TESTPCGFLAG(Used, USED) 63TESTPCGFLAG(Used, USED)
73CLEARPCGFLAG(Used, USED) 64CLEARPCGFLAG(Used, USED)
74SETPCGFLAG(Used, USED) 65SETPCGFLAG(Used, USED)
75 66
76SETPCGFLAG(FileMapped, FILE_MAPPED)
77CLEARPCGFLAG(FileMapped, FILE_MAPPED)
78TESTPCGFLAG(FileMapped, FILE_MAPPED)
79
80SETPCGFLAG(Migration, MIGRATION) 67SETPCGFLAG(Migration, MIGRATION)
81CLEARPCGFLAG(Migration, MIGRATION) 68CLEARPCGFLAG(Migration, MIGRATION)
82TESTPCGFLAG(Migration, MIGRATION) 69TESTPCGFLAG(Migration, MIGRATION)
@@ -85,7 +72,7 @@ static inline void lock_page_cgroup(struct page_cgroup *pc)
85{ 72{
86 /* 73 /*
87 * Don't take this lock in IRQ context. 74 * Don't take this lock in IRQ context.
88 * This lock is for pc->mem_cgroup, USED, CACHE, MIGRATION 75 * This lock is for pc->mem_cgroup, USED, MIGRATION
89 */ 76 */
90 bit_spin_lock(PCG_LOCK, &pc->flags); 77 bit_spin_lock(PCG_LOCK, &pc->flags);
91} 78}
@@ -95,24 +82,6 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc)
95 bit_spin_unlock(PCG_LOCK, &pc->flags); 82 bit_spin_unlock(PCG_LOCK, &pc->flags);
96} 83}
97 84
98static inline void move_lock_page_cgroup(struct page_cgroup *pc,
99 unsigned long *flags)
100{
101 /*
102 * We know updates to pc->flags of page cache's stats are from both of
103 * usual context or IRQ context. Disable IRQ to avoid deadlock.
104 */
105 local_irq_save(*flags);
106 bit_spin_lock(PCG_MOVE_LOCK, &pc->flags);
107}
108
109static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
110 unsigned long *flags)
111{
112 bit_spin_unlock(PCG_MOVE_LOCK, &pc->flags);
113 local_irq_restore(*flags);
114}
115
116#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 85#else /* CONFIG_CGROUP_MEM_RES_CTLR */
117struct page_cgroup; 86struct page_cgroup;
118 87