Re: [patch] mm, memcg: avoid unnecessary function call when memcg is disabled fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(2012/11/21 11:48), David Rientjes wrote:
Move the check for !mm out of line as suggested by Andrew.

Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>

Thank you very much !

Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>


---
  include/linux/memcontrol.h |    2 +-
  mm/memcontrol.c            |    3 +++
  2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -185,7 +185,7 @@ void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx);
  static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
  					     enum vm_event_item idx)
  {
-	if (mem_cgroup_disabled() || !mm)
+	if (mem_cgroup_disabled())
  		return;
  	__mem_cgroup_count_vm_event(mm, idx);
  }
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1021,6 +1021,9 @@ void __mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
  {
  	struct mem_cgroup *memcg;

+	if (!mm)
+		return;
+
  	rcu_read_lock();
  	memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));
  	if (unlikely(!memcg))



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]