[PATCH 1/2] mm: Allow using fast mm counters from other files

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

 



From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

Allow calling inc/dec_mm_counter_fast() from other files, not just memory.c

Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
 include/linux/mm.h |   10 ++++++++++
 mm/memory.c        |    7 +------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 17b27cd..ad8d314 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1082,6 +1082,16 @@ static inline void inc_mm_counter(struct mm_struct *mm, int member)
 	atomic_long_inc(&mm->rss_stat.count[member]);
 }
 
+#if defined(SPLIT_RSS_COUNTING)
+extern void add_mm_counter_fast(struct mm_struct *mm, int member, int val);
+
+#define inc_mm_counter_fast(mm, member) add_mm_counter_fast(mm, member, 1)
+#define dec_mm_counter_fast(mm, member) add_mm_counter_fast(mm, member, -1)
+#else
+#define inc_mm_counter_fast(mm, member) inc_mm_counter(mm, member)
+#define dec_mm_counter_fast(mm, member) inc_mm_counter_fast(mm, member)
+#endif
+
 static inline void dec_mm_counter(struct mm_struct *mm, int member)
 {
 	atomic_long_dec(&mm->rss_stat.count[member]);
diff --git a/mm/memory.c b/mm/memory.c
index fa2f04e..89d8401 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -138,7 +138,7 @@ static void __sync_task_rss_stat(struct task_struct *task, struct mm_struct *mm)
 	task->rss_stat.events = 0;
 }
 
-static void add_mm_counter_fast(struct mm_struct *mm, int member, int val)
+void add_mm_counter_fast(struct mm_struct *mm, int member, int val)
 {
 	struct task_struct *task = current;
 
@@ -147,8 +147,6 @@ static void add_mm_counter_fast(struct mm_struct *mm, int member, int val)
 	else
 		add_mm_counter(mm, member, val);
 }
-#define inc_mm_counter_fast(mm, member) add_mm_counter_fast(mm, member, 1)
-#define dec_mm_counter_fast(mm, member) add_mm_counter_fast(mm, member, -1)
 
 /* sync counter once per 64 page faults */
 #define TASK_RSS_EVENTS_THRESH	(64)
@@ -184,9 +182,6 @@ void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
 }
 #else /* SPLIT_RSS_COUNTING */
 
-#define inc_mm_counter_fast(mm, member) inc_mm_counter(mm, member)
-#define dec_mm_counter_fast(mm, member) dec_mm_counter(mm, member)
-
 static void check_sync_rss_stat(struct task_struct *task)
 {
 }
-- 
1.7.7.6

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
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]