From: KOSAKI Motohiro <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: [-mm][PATCH 2/5] introduce get_vm_event()
Date: Sun, 04 May 2008 21:57:14 +0900 [thread overview]
Message-ID: <20080504215602.8F58.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <20080504201343.8F52.KOSAKI.MOTOHIRO@jp.fujitsu.com>
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 | 14 ++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
Index: b/include/linux/vmstat.h
===================================================================
--- a/include/linux/vmstat.h 2008-05-02 23:40:39.000000000 +0900
+++ b/include/linux/vmstat.h 2008-05-03 00:23:17.000000000 +0900
@@ -92,6 +92,8 @@ static inline void vm_events_fold_cpu(in
}
#endif
+unsigned long get_vm_event(enum vm_event_item event_type);
+
#else
/* Disable counters */
@@ -113,7 +115,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 2008-05-02 23:40:39.000000000 +0900
+++ b/mm/vmstat.c 2008-05-02 23:43:28.000000000 +0900
@@ -46,6 +46,20 @@ 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;
+
+ for_each_cpu_mask(cpu, cpu_online_map) {
+ struct vm_event_state *this = &per_cpu(vm_event_states, cpu);
+
+ ret += this->event[event_type];
+ }
+
+ 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-05-04 12:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-04 12:53 [-mm][PATCH 0/5] mm: page reclaim throttle v6 KOSAKI Motohiro
2008-05-04 12:55 ` [-mm][PATCH 1/5] fix overflow problem of do_try_to_free_page() KOSAKI Motohiro
2008-05-05 8:12 ` Nishanth Aravamudan
2008-05-06 3:29 ` KOSAKI Motohiro
2008-05-04 12:57 ` KOSAKI Motohiro [this message]
2008-05-05 21:47 ` [-mm][PATCH 2/5] introduce get_vm_event() Rik van Riel
2008-05-04 12:58 ` [-mm][PATCH 3/5] change function prototype of shrink_zone() KOSAKI Motohiro
2008-05-05 4:42 ` minchan Kim
2008-05-05 8:31 ` KOSAKI Motohiro
2008-05-05 8:37 ` minchan Kim
2008-05-04 12:59 ` [-mm][PATCH 4/5] core of reclaim throttle KOSAKI Motohiro
2008-05-04 13:12 ` KOSAKI Motohiro
2008-05-05 5:21 ` minchan Kim
2008-05-05 8:24 ` KOSAKI Motohiro
2008-05-05 8:32 ` minchan Kim
2008-05-05 21:51 ` Rik van Riel
2008-05-05 22:23 ` KOSAKI Motohiro
2008-05-06 0:43 ` Rik van Riel
2008-05-06 1:01 ` KOSAKI Motohiro
2008-05-04 13:01 ` [-mm][PATCH 5/5] introduce sysctl parameter of max task of throttle KOSAKI Motohiro
2008-05-04 14:38 ` [-mm][PATCH 0/5] mm: page reclaim throttle v6 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=20080504215602.8F58.KOSAKI.MOTOHIRO@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