diff mbox

[3/5] vmevent: Refresh vmstats before sampling

Message ID 1338553446-22292-3-git-send-email-anton.vorontsov@linaro.org
State New
Headers show

Commit Message

Anton Vorontsov June 1, 2012, 12:24 p.m. UTC
On SMP, kernel updates vmstats only once per second, which makes vmevent
unusable. Let's fix it by updating vmstats before sampling.

Reported-by: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
---
 mm/vmevent.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Christoph Lameter (Ampere) June 5, 2012, 2:36 p.m. UTC | #1
On Fri, 1 Jun 2012, Anton Vorontsov wrote:

> On SMP, kernel updates vmstats only once per second, which makes vmevent
> unusable. Let's fix it by updating vmstats before sampling.

Well this may increase your accuracy but there is no guarantee that an
update to vm counters will not happen immediately after you have refreshed
the counters for one processor or the other.

Also please consider the impact that a IPI broadcast will have on latency
of other processors and to the function that is currently executing.

We just went through a round of getting rid of IPI broadcast because they
create OS noise on processors.
diff mbox

Patch

diff --git a/mm/vmevent.c b/mm/vmevent.c
index 4ca2a04..35fd0d5 100644
--- a/mm/vmevent.c
+++ b/mm/vmevent.c
@@ -2,6 +2,7 @@ 
 #include <linux/atomic.h>
 #include <linux/compiler.h>
 #include <linux/vmevent.h>
+#include <linux/mm.h>
 #include <linux/syscalls.h>
 #include <linux/workqueue.h>
 #include <linux/file.h>
@@ -163,6 +164,9 @@  static void vmevent_sample(struct vmevent_watch *watch)
 
 	if (atomic_read(&watch->pending))
 		return;
+
+	refresh_vm_stats();
+
 	if (!vmevent_match(watch))
 		return;