diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2015-02-11 18:25:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-11 20:06:00 -0500 |
commit | 6de226191d12fce30331ebf024ca3ed24834f0ee (patch) | |
tree | 74d4910406255087f3e72c0e4d483513d8449ad4 /mm/rmap.c | |
parent | 93aa7d95248d04b934eb8e89717c7b8d6400bf2b (diff) |
mm: memcontrol: track move_lock state internally
The complexity of memcg page stat synchronization is currently leaking
into the callsites, forcing them to keep track of the move_lock state and
the IRQ flags. Simplify the API by tracking it in the memcg.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Reviewed-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/rmap.c')
-rw-r--r-- | mm/rmap.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -1085,24 +1085,20 @@ void page_add_new_anon_rmap(struct page *page, | |||
1085 | void page_add_file_rmap(struct page *page) | 1085 | void page_add_file_rmap(struct page *page) |
1086 | { | 1086 | { |
1087 | struct mem_cgroup *memcg; | 1087 | struct mem_cgroup *memcg; |
1088 | unsigned long flags; | ||
1089 | bool locked; | ||
1090 | 1088 | ||
1091 | memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); | 1089 | memcg = mem_cgroup_begin_page_stat(page); |
1092 | if (atomic_inc_and_test(&page->_mapcount)) { | 1090 | if (atomic_inc_and_test(&page->_mapcount)) { |
1093 | __inc_zone_page_state(page, NR_FILE_MAPPED); | 1091 | __inc_zone_page_state(page, NR_FILE_MAPPED); |
1094 | mem_cgroup_inc_page_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED); | 1092 | mem_cgroup_inc_page_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED); |
1095 | } | 1093 | } |
1096 | mem_cgroup_end_page_stat(memcg, &locked, &flags); | 1094 | mem_cgroup_end_page_stat(memcg); |
1097 | } | 1095 | } |
1098 | 1096 | ||
1099 | static void page_remove_file_rmap(struct page *page) | 1097 | static void page_remove_file_rmap(struct page *page) |
1100 | { | 1098 | { |
1101 | struct mem_cgroup *memcg; | 1099 | struct mem_cgroup *memcg; |
1102 | unsigned long flags; | ||
1103 | bool locked; | ||
1104 | 1100 | ||
1105 | memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); | 1101 | memcg = mem_cgroup_begin_page_stat(page); |
1106 | 1102 | ||
1107 | /* page still mapped by someone else? */ | 1103 | /* page still mapped by someone else? */ |
1108 | if (!atomic_add_negative(-1, &page->_mapcount)) | 1104 | if (!atomic_add_negative(-1, &page->_mapcount)) |
@@ -1123,7 +1119,7 @@ static void page_remove_file_rmap(struct page *page) | |||
1123 | if (unlikely(PageMlocked(page))) | 1119 | if (unlikely(PageMlocked(page))) |
1124 | clear_page_mlock(page); | 1120 | clear_page_mlock(page); |
1125 | out: | 1121 | out: |
1126 | mem_cgroup_end_page_stat(memcg, &locked, &flags); | 1122 | mem_cgroup_end_page_stat(memcg); |
1127 | } | 1123 | } |
1128 | 1124 | ||
1129 | /** | 1125 | /** |