From: kosaki.motohiro@jp.fujitsu.com
To: LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: kosaki.motohiro@jp.fujitsu.com
Subject: [PATCH 2/5] introduce get_vm_event().
Date: Thu, 05 Jun 2008 11:12:13 +0900 [thread overview]
Message-ID: <20080605021504.502113040@jp.fujitsu.com> (raw)
In-Reply-To: <20080605021211.871673550@jp.fujitsu.com>
[-- Attachment #1: 02-get_vm_event.patch --]
[-- Type: text/plain, Size: 1725 bytes --]
introduce get_vm_event() new function for easy use vm statics.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
include/linux/vmstat.h | 7 ++++++-
mm/vmstat.c | 16 ++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
Index: b/include/linux/vmstat.h
===================================================================
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -98,6 +98,8 @@ static inline void vm_events_fold_cpu(in
}
#endif
+unsigned long get_vm_event(enum vm_event_item event_type);
+
#else
/* Disable counters */
@@ -119,7 +121,10 @@ static inline void all_vm_events(unsigne
static inline void vm_events_fold_cpu(int cpu)
{
}
-
+static inline unsigned long get_vm_event(enum vm_event_item event_type)
+{
+ return 0;
+}
#endif /* CONFIG_VM_EVENT_COUNTERS */
#define __count_zone_vm_events(item, zone, delta) \
Index: b/mm/vmstat.c
===================================================================
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -49,6 +49,22 @@ void all_vm_events(unsigned long *ret)
}
EXPORT_SYMBOL_GPL(all_vm_events);
+unsigned long get_vm_event(enum vm_event_item event_type)
+{
+ int cpu;
+ unsigned long ret = 0;
+
+ get_online_cpus();
+ for_each_online_cpu(cpu) {
+ struct vm_event_state *this = &per_cpu(vm_event_states, cpu);
+
+ ret += this->event[event_type];
+ }
+ put_online_cpus();
+
+ return ret;
+}
+
#ifdef CONFIG_HOTPLUG
/*
* Fold the foreign cpu events into our own.
--
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-06-05 2:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-05 2:12 [PATCH 0/5] page reclaim throttle v7 kosaki.motohiro
2008-06-05 2:06 ` KAMEZAWA Hiroyuki
2008-06-05 2:23 ` KOSAKI Motohiro
2008-06-05 2:12 ` [PATCH 1/5] fix incorrect variable type of do_try_to_free_pages() kosaki.motohiro
2008-06-05 1:26 ` KOSAKI Motohiro
2008-06-05 2:12 ` kosaki.motohiro [this message]
2008-06-05 1:29 ` [PATCH 2/5] introduce get_vm_event() KOSAKI Motohiro
2008-06-05 2:12 ` [PATCH 3/5] change return type of shrink_zone() kosaki.motohiro
2008-06-05 2:12 ` [PATCH 4/5] add throttle to shrink_zone() kosaki.motohiro
2008-06-08 20:12 ` Andrew Morton
2008-06-09 0:38 ` KOSAKI Motohiro
2008-06-05 2:12 ` [PATCH 5/5] introduce sysctl of throttle kosaki.motohiro
2008-06-08 20:09 ` Andrew Morton
2008-06-09 0:37 ` KOSAKI Motohiro
2008-06-08 20:10 ` Andrew Morton
2008-06-09 0:34 ` KOSAKI Motohiro
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=20080605021504.502113040@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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