Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

KAMEZAWA Hiroyuki and committed by
Linus Torvalds
2f3479b1 cc926f78

+6 -14
+6 -14
mm/memcontrol.c
··· 2592 2592 * @pc: page_cgroup of the page. 2593 2593 * @from: mem_cgroup which the page is moved from. 2594 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 2596 * The caller must confirm following. 2598 2597 * - page is not on LRU (isolate_page() is useful.) 2599 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 2602 - * done by a caller(__mem_cgroup_try_charge would be useful). If @uncharge is 2603 - * true, this function does "uncharge" from old cgroup, but it doesn't if 2604 - * @uncharge is false, so a caller should do "uncharge". 2600 + * This function doesn't do "charge" to new cgroup and doesn't do "uncharge" 2601 + * from old cgroup. 2605 2602 */ 2606 2603 static int mem_cgroup_move_account(struct page *page, 2607 2604 unsigned int nr_pages, 2608 2605 struct page_cgroup *pc, 2609 2606 struct mem_cgroup *from, 2610 - struct mem_cgroup *to, 2611 - bool uncharge) 2607 + struct mem_cgroup *to) 2612 2608 { 2613 2609 unsigned long flags; 2614 2610 int ret; ··· 2638 2642 preempt_enable(); 2639 2643 } 2640 2644 mem_cgroup_charge_statistics(from, anon, -nr_pages); 2641 - if (uncharge) 2642 - /* This is not "cancel", but cancel_charge does all we need. */ 2643 - __mem_cgroup_cancel_charge(from, nr_pages); 2644 2645 2645 2646 /* caller should have done css_get */ 2646 2647 pc->mem_cgroup = to; ··· 2699 2706 flags = compound_lock_irqsave(page); 2700 2707 2701 2708 ret = mem_cgroup_move_account(page, nr_pages, 2702 - pc, child, parent, false); 2709 + pc, child, parent); 2703 2710 if (!ret) 2704 2711 __mem_cgroup_cancel_local_charge(child, nr_pages); 2705 2712 ··· 5467 5474 if (!isolate_lru_page(page)) { 5468 5475 pc = lookup_page_cgroup(page); 5469 5476 if (!mem_cgroup_move_account(page, HPAGE_PMD_NR, 5470 - pc, mc.from, mc.to, 5471 - false)) { 5477 + pc, mc.from, mc.to)) { 5472 5478 mc.precharge -= HPAGE_PMD_NR; 5473 5479 mc.moved_charge += HPAGE_PMD_NR; 5474 5480 } ··· 5497 5505 goto put; 5498 5506 pc = lookup_page_cgroup(page); 5499 5507 if (!mem_cgroup_move_account(page, 1, pc, 5500 - mc.from, mc.to, false)) { 5508 + mc.from, mc.to)) { 5501 5509 mc.precharge--; 5502 5510 /* we uncharge from mc.from later. */ 5503 5511 mc.moved_charge++;