diff options
author | Konstantin Khlebnikov <khlebnikov@openvz.org> | 2012-05-29 18:07:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:26 -0400 |
commit | c56d5c7dfeb5cc754e17fa3d423086a3c551c219 (patch) | |
tree | 4c89ad9692dbd3a2e0eaf96de0162a5d3066925e /mm/memcontrol.c | |
parent | 074291fea8bcedeabf295360e2ddd9bbb5830b4a (diff) |
mm/vmscan: push lruvec pointer into inactive_list_is_low()
Switch mem_cgroup_inactive_anon_is_low() to lruvec pointers,
mem_cgroup_get_lruvec_size() is more effective than
mem_cgroup_zone_nr_lru_pages()
Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index a68db296ada6..9d1764630dff 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1208,19 +1208,15 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *memcg) | |||
1208 | return ret; | 1208 | return ret; |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone) | 1211 | int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec) |
1212 | { | 1212 | { |
1213 | unsigned long inactive_ratio; | 1213 | unsigned long inactive_ratio; |
1214 | int nid = zone_to_nid(zone); | ||
1215 | int zid = zone_idx(zone); | ||
1216 | unsigned long inactive; | 1214 | unsigned long inactive; |
1217 | unsigned long active; | 1215 | unsigned long active; |
1218 | unsigned long gb; | 1216 | unsigned long gb; |
1219 | 1217 | ||
1220 | inactive = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid, | 1218 | inactive = mem_cgroup_get_lruvec_size(lruvec, LRU_INACTIVE_ANON); |
1221 | BIT(LRU_INACTIVE_ANON)); | 1219 | active = mem_cgroup_get_lruvec_size(lruvec, LRU_ACTIVE_ANON); |
1222 | active = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid, | ||
1223 | BIT(LRU_ACTIVE_ANON)); | ||
1224 | 1220 | ||
1225 | gb = (inactive + active) >> (30 - PAGE_SHIFT); | 1221 | gb = (inactive + active) >> (30 - PAGE_SHIFT); |
1226 | if (gb) | 1222 | if (gb) |
@@ -1231,17 +1227,13 @@ int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone) | |||
1231 | return inactive * inactive_ratio < active; | 1227 | return inactive * inactive_ratio < active; |
1232 | } | 1228 | } |
1233 | 1229 | ||
1234 | int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg, struct zone *zone) | 1230 | int mem_cgroup_inactive_file_is_low(struct lruvec *lruvec) |
1235 | { | 1231 | { |
1236 | unsigned long active; | 1232 | unsigned long active; |
1237 | unsigned long inactive; | 1233 | unsigned long inactive; |
1238 | int zid = zone_idx(zone); | ||
1239 | int nid = zone_to_nid(zone); | ||
1240 | 1234 | ||
1241 | inactive = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid, | 1235 | inactive = mem_cgroup_get_lruvec_size(lruvec, LRU_INACTIVE_FILE); |
1242 | BIT(LRU_INACTIVE_FILE)); | 1236 | active = mem_cgroup_get_lruvec_size(lruvec, LRU_ACTIVE_FILE); |
1243 | active = mem_cgroup_zone_nr_lru_pages(memcg, nid, zid, | ||
1244 | BIT(LRU_ACTIVE_FILE)); | ||
1245 | 1237 | ||
1246 | return (active > inactive); | 1238 | return (active > inactive); |
1247 | } | 1239 | } |