diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2012-05-29 18:07:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:27 -0400 |
commit | 2f3479b1478e223f142fe9cd27a2d2a4c3573c53 (patch) | |
tree | 87290215e74631106498dde89c43fa378bf9ede1 /mm | |
parent | cc926f78420705817b807dbec0c5d3643827eba3 (diff) |
memcg: don't uncharge in mem_cgroup_move_account()
Now, all callers pass 'false' for 'bool uncharge' so remove this argument.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ying Han <yinghan@google.com>
Cc: Glauber Costa <glommer@parallels.com>
Reviewed-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-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 96cd9ebefb2c..37bae5571a47 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2592,23 +2592,19 @@ void mem_cgroup_split_huge_fixup(struct page *head) | |||
2592 | * @pc: page_cgroup of the page. | 2592 | * @pc: page_cgroup of the page. |
2593 | * @from: mem_cgroup which the page is moved from. | 2593 | * @from: mem_cgroup which the page is moved from. |
2594 | * @to: mem_cgroup which the page is moved to. @from != @to. | 2594 | * @to: mem_cgroup which the page is moved to. @from != @to. |
2595 | * @uncharge: whether we should call uncharge and css_put against @from. | ||
2596 | * | 2595 | * |
2597 | * The caller must confirm following. | 2596 | * The caller must confirm following. |
2598 | * - page is not on LRU (isolate_page() is useful.) | 2597 | * - page is not on LRU (isolate_page() is useful.) |
2599 | * - compound_lock is held when nr_pages > 1 | 2598 | * - compound_lock is held when nr_pages > 1 |
2600 | * | 2599 | * |
2601 | * This function doesn't do "charge" nor css_get to new cgroup. It should be | 2600 | * This function doesn't do "charge" to new cgroup and doesn't do "uncharge" |
2602 | * done by a caller(__mem_cgroup_try_charge would be useful). If @uncharge is | 2601 | * from old cgroup. |
2603 | * true, this function does "uncharge" from old cgroup, but it doesn't if | ||
2604 | * @uncharge is false, so a caller should do "uncharge". | ||
2605 | */ | 2602 | */ |
2606 | static int mem_cgroup_move_account(struct page *page, | 2603 | static int mem_cgroup_move_account(struct page *page, |
2607 | unsigned int nr_pages, | 2604 | unsigned int nr_pages, |
2608 | struct page_cgroup *pc, | 2605 | struct page_cgroup *pc, |
2609 | struct mem_cgroup *from, | 2606 | struct mem_cgroup *from, |
2610 | struct mem_cgroup *to, | 2607 | struct mem_cgroup *to) |
2611 | bool uncharge) | ||
2612 | { | 2608 | { |
2613 | unsigned long flags; | 2609 | unsigned long flags; |
2614 | int ret; | 2610 | int ret; |
@@ -2642,9 +2638,6 @@ static int mem_cgroup_move_account(struct page *page, | |||
2642 | preempt_enable(); | 2638 | preempt_enable(); |
2643 | } | 2639 | } |
2644 | mem_cgroup_charge_statistics(from, anon, -nr_pages); | 2640 | mem_cgroup_charge_statistics(from, anon, -nr_pages); |
2645 | if (uncharge) | ||
2646 | /* This is not "cancel", but cancel_charge does all we need. */ | ||
2647 | __mem_cgroup_cancel_charge(from, nr_pages); | ||
2648 | 2641 | ||
2649 | /* caller should have done css_get */ | 2642 | /* caller should have done css_get */ |
2650 | pc->mem_cgroup = to; | 2643 | pc->mem_cgroup = to; |
@@ -2706,7 +2699,7 @@ static int mem_cgroup_move_parent(struct page *page, | |||
2706 | flags = compound_lock_irqsave(page); | 2699 | flags = compound_lock_irqsave(page); |
2707 | 2700 | ||
2708 | ret = mem_cgroup_move_account(page, nr_pages, | 2701 | ret = mem_cgroup_move_account(page, nr_pages, |
2709 | pc, child, parent, false); | 2702 | pc, child, parent); |
2710 | if (!ret) | 2703 | if (!ret) |
2711 | __mem_cgroup_cancel_local_charge(child, nr_pages); | 2704 | __mem_cgroup_cancel_local_charge(child, nr_pages); |
2712 | 2705 | ||
@@ -5474,8 +5467,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, | |||
5474 | if (!isolate_lru_page(page)) { | 5467 | if (!isolate_lru_page(page)) { |
5475 | pc = lookup_page_cgroup(page); | 5468 | pc = lookup_page_cgroup(page); |
5476 | if (!mem_cgroup_move_account(page, HPAGE_PMD_NR, | 5469 | if (!mem_cgroup_move_account(page, HPAGE_PMD_NR, |
5477 | pc, mc.from, mc.to, | 5470 | pc, mc.from, mc.to)) { |
5478 | false)) { | ||
5479 | mc.precharge -= HPAGE_PMD_NR; | 5471 | mc.precharge -= HPAGE_PMD_NR; |
5480 | mc.moved_charge += HPAGE_PMD_NR; | 5472 | mc.moved_charge += HPAGE_PMD_NR; |
5481 | } | 5473 | } |
@@ -5505,7 +5497,7 @@ retry: | |||
5505 | goto put; | 5497 | goto put; |
5506 | pc = lookup_page_cgroup(page); | 5498 | pc = lookup_page_cgroup(page); |
5507 | if (!mem_cgroup_move_account(page, 1, pc, | 5499 | if (!mem_cgroup_move_account(page, 1, pc, |
5508 | mc.from, mc.to, false)) { | 5500 | mc.from, mc.to)) { |
5509 | mc.precharge--; | 5501 | mc.precharge--; |
5510 | /* we uncharge from mc.from later. */ | 5502 | /* we uncharge from mc.from later. */ |
5511 | mc.moved_charge++; | 5503 | mc.moved_charge++; |