[patch] mm: memcontrol: micro-optimize mem_cgroup_update_page_stat()
From: Johannes Weiner
Date: Mon Oct 20 2014 - 11:17:55 EST
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@xxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/