diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2012-03-21 19:34:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-21 20:55:01 -0400 |
commit | b24028572fb69e9dd6de8c359eba2b2c66baa889 (patch) | |
tree | 563594eba40e5fd0b61c36c09705f128a8dfbe40 /include/linux/page_cgroup.h | |
parent | ca464d69b19120a826aa2534de2511a6f542edf5 (diff) |
memcg: remove PCG_CACHE page_cgroup flag
We record 'the page is cache' with the PCG_CACHE bit in page_cgroup.
Here, "CACHE" means anonymous user pages (and SwapCache). This doesn't
include shmem.
Considering callers, at charge/uncharge, the caller should know what the
page is and we don't need to record it by using one bit per page.
This patch removes PCG_CACHE bit and make callers of
mem_cgroup_charge_statistics() to specify what the page is.
About page migration: Mapping of the used page is not touched during migra
tion (see page_remove_rmap) so we can rely on it and push the correct
charge type down to __mem_cgroup_uncharge_common from end_migration for
unused page. The force flag was misleading was abused for skipping the
needless page_mapped() / PageCgroupMigration() check, as we know the
unused page is no longer mapped and cleared the migration flag just a few
lines up. But doing the checks is no biggie and it's not worth adding
another flag just to skip them.
[akpm@linux-foundation.org: checkpatch fixes]
[hughd@google.com: fix PageAnon uncharging]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ying Han <yinghan@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/page_cgroup.h')
-rw-r--r-- | include/linux/page_cgroup.h | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h index a2d11771c84b..106029243ff4 100644 --- a/include/linux/page_cgroup.h +++ b/include/linux/page_cgroup.h | |||
@@ -4,7 +4,6 @@ | |||
4 | enum { | 4 | enum { |
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 */ | 9 | /* flags for mem_cgroup and file and I/O status */ |
@@ -64,11 +63,6 @@ static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \ | |||
64 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ | 63 | static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \ |
65 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } | 64 | { return test_and_clear_bit(PCG_##lname, &pc->flags); } |
66 | 65 | ||
67 | /* Cache flag is set only once (at allocation) */ | ||
68 | TESTPCGFLAG(Cache, CACHE) | ||
69 | CLEARPCGFLAG(Cache, CACHE) | ||
70 | SETPCGFLAG(Cache, CACHE) | ||
71 | |||
72 | TESTPCGFLAG(Used, USED) | 66 | TESTPCGFLAG(Used, USED) |
73 | CLEARPCGFLAG(Used, USED) | 67 | CLEARPCGFLAG(Used, USED) |
74 | SETPCGFLAG(Used, USED) | 68 | SETPCGFLAG(Used, USED) |
@@ -85,7 +79,7 @@ static inline void lock_page_cgroup(struct page_cgroup *pc) | |||
85 | { | 79 | { |
86 | /* | 80 | /* |
87 | * Don't take this lock in IRQ context. | 81 | * Don't take this lock in IRQ context. |
88 | * This lock is for pc->mem_cgroup, USED, CACHE, MIGRATION | 82 | * This lock is for pc->mem_cgroup, USED, MIGRATION |
89 | */ | 83 | */ |
90 | bit_spin_lock(PCG_LOCK, &pc->flags); | 84 | bit_spin_lock(PCG_LOCK, &pc->flags); |
91 | } | 85 | } |