linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: linux-kernel@vger.kernel.org
Cc: tim.c.chen@linux.intel.com, linux-mm@kvack.org,
	Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 1/2] mm: Allow using fast mm counters from other files
Date: Sat, 31 Mar 2012 07:09:56 -0700	[thread overview]
Message-ID: <1333202997-19550-2-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1333202997-19550-1-git-send-email-andi@firstfloor.org>

From: Andi Kleen <ak@linux.intel.com>

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

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 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@kvack.org.  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@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-03-31 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-31 14:09 Huge page counter speedup complete Andi Kleen
2012-03-31 14:09 ` Andi Kleen [this message]
2012-04-09  7:50   ` [PATCH 1/2] mm: Allow using fast mm counters from other files KAMEZAWA Hiroyuki
2012-03-31 14:09 ` [PATCH 2/2] huge-memory: Use fast mm counters for transparent huge pages Andi Kleen
2012-04-09  7:53   ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1333202997-19550-2-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=tim.c.chen@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).