diff options
author | Johannes Weiner <jweiner@redhat.com> | 2012-01-12 20:18:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:06 -0500 |
commit | 7a0524cfc8f9f585471a31b1282a9ce4a1a7d444 (patch) | |
tree | 4e31e1ec7e892d67e48d1199b9e8590ad5718e7a | |
parent | 00c54c0bac24bb02d2460c516da76651a7451286 (diff) |
mm: memcg: remove unneeded checks from newpage_charge()
All callsites pass in freshly allocated pages and a valid mm. As a
result, all checks pertaining to the page's mapcount, page->mapping or the
fallback to init_mm are unneeded.
Signed-off-by: Johannes Weiner <jweiner@redhat.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/memcontrol.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index a63ad141083c..2450d89486d4 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -2748,19 +2748,11 @@ int mem_cgroup_newpage_charge(struct page *page, | |||
2748 | { | 2748 | { |
2749 | if (mem_cgroup_disabled()) | 2749 | if (mem_cgroup_disabled()) |
2750 | return 0; | 2750 | return 0; |
2751 | /* | 2751 | VM_BUG_ON(page_mapped(page)); |
2752 | * If already mapped, we don't have to account. | 2752 | VM_BUG_ON(page->mapping && !PageAnon(page)); |
2753 | * If page cache, page->mapping has address_space. | 2753 | VM_BUG_ON(!mm); |
2754 | * But page->mapping may have out-of-use anon_vma pointer, | ||
2755 | * detecit it by PageAnon() check. newly-mapped-anon's page->mapping | ||
2756 | * is NULL. | ||
2757 | */ | ||
2758 | if (page_mapped(page) || (page->mapping && !PageAnon(page))) | ||
2759 | return 0; | ||
2760 | if (unlikely(!mm)) | ||
2761 | mm = &init_mm; | ||
2762 | return mem_cgroup_charge_common(page, mm, gfp_mask, | 2754 | return mem_cgroup_charge_common(page, mm, gfp_mask, |
2763 | MEM_CGROUP_CHARGE_TYPE_MAPPED); | 2755 | MEM_CGROUP_CHARGE_TYPE_MAPPED); |
2764 | } | 2756 | } |
2765 | 2757 | ||
2766 | static void | 2758 | static void |