diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2011-03-23 19:42:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-23 22:46:30 -0400 |
commit | 7ffd4ca7a2cdd7a18f0b499a4e9e0e7cf36ba018 (patch) | |
tree | 1a2678ce91b9dfb2118d19e0ec457ca5582793f9 /mm/memcontrol.c | |
parent | 11c9ea4e80fc3be83485667204c68d0a732f3757 (diff) |
memcg: convert uncharge batching from bytes to page granularity
We never uncharge subpage quantities.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@linux.vnet.ibm.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 | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 91120a04f935..9dfbed2aacc9 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2579,9 +2579,9 @@ __do_uncharge(struct mem_cgroup *mem, const enum charge_type ctype, | |||
2579 | if (batch->memcg != mem) | 2579 | if (batch->memcg != mem) |
2580 | goto direct_uncharge; | 2580 | goto direct_uncharge; |
2581 | /* remember freed charge and uncharge it later */ | 2581 | /* remember freed charge and uncharge it later */ |
2582 | batch->bytes += PAGE_SIZE; | 2582 | batch->nr_pages++; |
2583 | if (uncharge_memsw) | 2583 | if (uncharge_memsw) |
2584 | batch->memsw_bytes += PAGE_SIZE; | 2584 | batch->memsw_nr_pages++; |
2585 | return; | 2585 | return; |
2586 | direct_uncharge: | 2586 | direct_uncharge: |
2587 | res_counter_uncharge(&mem->res, page_size); | 2587 | res_counter_uncharge(&mem->res, page_size); |
@@ -2708,8 +2708,8 @@ void mem_cgroup_uncharge_start(void) | |||
2708 | /* We can do nest. */ | 2708 | /* We can do nest. */ |
2709 | if (current->memcg_batch.do_batch == 1) { | 2709 | if (current->memcg_batch.do_batch == 1) { |
2710 | current->memcg_batch.memcg = NULL; | 2710 | current->memcg_batch.memcg = NULL; |
2711 | current->memcg_batch.bytes = 0; | 2711 | current->memcg_batch.nr_pages = 0; |
2712 | current->memcg_batch.memsw_bytes = 0; | 2712 | current->memcg_batch.memsw_nr_pages = 0; |
2713 | } | 2713 | } |
2714 | } | 2714 | } |
2715 | 2715 | ||
@@ -2730,10 +2730,12 @@ void mem_cgroup_uncharge_end(void) | |||
2730 | * This "batch->memcg" is valid without any css_get/put etc... | 2730 | * This "batch->memcg" is valid without any css_get/put etc... |
2731 | * bacause we hide charges behind us. | 2731 | * bacause we hide charges behind us. |
2732 | */ | 2732 | */ |
2733 | if (batch->bytes) | 2733 | if (batch->nr_pages) |
2734 | res_counter_uncharge(&batch->memcg->res, batch->bytes); | 2734 | res_counter_uncharge(&batch->memcg->res, |
2735 | if (batch->memsw_bytes) | 2735 | batch->nr_pages * PAGE_SIZE); |
2736 | res_counter_uncharge(&batch->memcg->memsw, batch->memsw_bytes); | 2736 | if (batch->memsw_nr_pages) |
2737 | res_counter_uncharge(&batch->memcg->memsw, | ||
2738 | batch->memsw_nr_pages * PAGE_SIZE); | ||
2737 | memcg_oom_recover(batch->memcg); | 2739 | memcg_oom_recover(batch->memcg); |
2738 | /* forget this pointer (for sanity check) */ | 2740 | /* forget this pointer (for sanity check) */ |
2739 | batch->memcg = NULL; | 2741 | batch->memcg = NULL; |