summaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorJohannes Weiner <jweiner@redhat.com>2012-01-12 17:18:43 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-12 20:13:06 -0800
commit7a0524cfc8f9f585471a31b1282a9ce4a1a7d444 (patch)
tree4e31e1ec7e892d67e48d1199b9e8590ad5718e7a /mm/memcontrol.c
parent00c54c0bac24bb02d2460c516da76651a7451286 (diff)
downloadop-kernel-dev-7a0524cfc8f9f585471a31b1282a9ce4a1a7d444.zip
op-kernel-dev-7a0524cfc8f9f585471a31b1282a9ce4a1a7d444.tar.gz
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>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a63ad14..2450d89 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2748,19 +2748,11 @@ int mem_cgroup_newpage_charge(struct page *page,
{
if (mem_cgroup_disabled())
return 0;
- /*
- * If already mapped, we don't have to account.
- * If page cache, page->mapping has address_space.
- * But page->mapping may have out-of-use anon_vma pointer,
- * detecit it by PageAnon() check. newly-mapped-anon's page->mapping
- * is NULL.
- */
- if (page_mapped(page) || (page->mapping && !PageAnon(page)))
- return 0;
- if (unlikely(!mm))
- mm = &init_mm;
+ VM_BUG_ON(page_mapped(page));
+ VM_BUG_ON(page->mapping && !PageAnon(page));
+ VM_BUG_ON(!mm);
return mem_cgroup_charge_common(page, mm, gfp_mask,
- MEM_CGROUP_CHARGE_TYPE_MAPPED);
+ MEM_CGROUP_CHARGE_TYPE_MAPPED);
}
static void
OpenPOWER on IntegriCloud