RE: vmstat: use our own timer events

From: Pallipadi, Venkatesh
Date: Wed May 02 2007 - 14:13:48 EST




>-----Original Message-----
>From: linux-kernel-owner@xxxxxxxxxxxxxxx
>[mailto:linux-kernel-owner@xxxxxxxxxxxxxxx] On Behalf Of
>Christoph Lameter
>Sent: Saturday, April 28, 2007 10:09 PM
>To: akpm@xxxxxxxxxxxxxxxxxxxx
>Cc: linux-kernel@xxxxxxxxxxxxxxx; Arjan van de Ven
>Subject: vmstat: use our own timer events
>
>
>We could implement an alternate approach that runs the first processor
>on each node at the second and then each of the other processor on a
>node on a subsequent tick. That may be useful to keep a large amount
>of the second free of timer activity. Maybe the timer folks will have
>some feedback on this one?
>

Can this use 'deferrable timer' along with round_jiffies. That
will eliminate the issue of too frequent interrupt when CPU is idle.


>CC: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
>Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
>
>Index: slub/mm/vmstat.c
>===================================================================
>--- slub.orig/mm/vmstat.c 2007-04-28 19:30:01.000000000 -0700
>+++ slub/mm/vmstat.c 2007-04-28 19:36:38.000000000 -0700
>@@ -640,6 +640,22 @@ const struct seq_operations vmstat_op =
> #endif /* CONFIG_PROC_FS */
>
> #ifdef CONFIG_SMP
>+static DEFINE_PER_CPU(struct delayed_work, vmstat_work);
>+
>+static void vmstat_update(struct work_struct *w)
>+{
>+ refresh_cpu_vm_stats(smp_processor_id());
>+ schedule_delayed_work(&__get_cpu_var(vmstat_work), HZ);
>+}
>+
>+static void __devinit start_cpu_timer(int cpu)
>+{
>+ struct delayed_work *vmstat_work = &per_cpu(vmstat_work, cpu);
>+
>+ INIT_DELAYED_WORK(vmstat_work, vmstat_update);

This change alone should help.
INIT_DELAYED_WORK_DEFERRABLE(vmstat_work, vmstat_update);


>+ schedule_delayed_work_on(cpu, vmstat_work, HZ + cpu);
>+}
>+


Thanks,
Venki

Thanks,
Venki
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/