[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1413818259-10913-1-git-send-email-hannes@cmpxchg.org>
Date: Mon, 20 Oct 2014 11:17:39 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Michal Hocko <mhocko@...e.cz>,
Vladimir Davydov <vdavydov@...allels.com>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [patch] mm: memcontrol: micro-optimize mem_cgroup_update_page_stat()
Do not look up the page_cgroup when the memory controller is
runtime-disabled, but do assert that the locking protocol is followed
under DEBUG_VM regardless. Also remove the unused flags variable.
Signed-off-by: Johannes Weiner <hannes@...xchg.org>
---
mm/memcontrol.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 76892eb89d26..bea3fddb3372 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2177,13 +2177,14 @@ void mem_cgroup_update_page_stat(struct page *page,
enum mem_cgroup_stat_index idx, int val)
{
struct mem_cgroup *memcg;
- struct page_cgroup *pc = lookup_page_cgroup(page);
- unsigned long uninitialized_var(flags);
+ struct page_cgroup *pc;
+
+ VM_BUG_ON(!rcu_read_lock_held());
if (mem_cgroup_disabled())
return;
- VM_BUG_ON(!rcu_read_lock_held());
+ pc = lookup_page_cgroup(page);
memcg = pc->mem_cgroup;
if (unlikely(!memcg || !PageCgroupUsed(pc)))
return;
--
2.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists