Re: kupdate & laptop's [patch for integration of mobile-update]

Peter Englmaier (ppe@pa.uky.edu)
Sat, 14 Aug 1999 15:40:05 -0400 (EDT)


> Yes, you need a:
>
> echo 40 500 64 256 0 >/proc/sys/vm/bdflush
>
> to disable kupdate. Then it will go to sleep.
>
> To reenable kupdate you need to:
>
> echo 40 500 64 256 500 >/proc/sys/vm/bdflush
>
> and _then_ send it a SIGCONT. (note on Alpha the second 500 has to be
> close to 5000 since HZ is 1024 there)

Maybe a better fix would be to integrate mobile-update in 'kupdate'?
I've attached a possible patch to fs/buffer.c below. The idea is based
on mobile-update, but I simplified it a bit and it checks for activity
on all IDE(?) disks. I don't know how to make it a compile option,
yet. Maybe it would be even better to activate mobile-update only if
running on battery? Anyway, the patch seems to work for me.

Cheers, Peter.

--- buffer.c.ORIGINAL Sat Aug 14 14:08:07 1999
+++ buffer.c Sat Aug 14 15:21:35 1999
@@ -1,3 +1,4 @@
+#define MOBILE_UPDATE
/*
* linux/fs/buffer.c
*
@@ -37,6 +38,10 @@
#include <linux/init.h>
#include <linux/quotaops.h>

+#ifdef MOBILE_UPDATE
+#include <linux/kernel_stat.h>
+#endif
+
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/bitops.h>
@@ -1837,6 +1842,10 @@
{
struct task_struct * tsk = current;
int interval;
+#ifdef MOBILE_UPDATE
+ int dsk, activity;
+ static unsigned int disk_activity[DK_NDRIVE];
+#endif

tsk->session = 1;
tsk->pgrp = 1;
@@ -1862,6 +1871,32 @@
#ifdef DEBUG
printk("kupdate() activated...\n");
#endif
+#ifdef MOBILE_UPDATE
+ /* Find out if there was any disk activity */
+ activity=0;
+ for (dsk=0; dsk<DK_NDRIVE; dsk++)
+ activity |= kstat.dk_drive[dsk] != disk_activity[dsk];
+
+ /* If there was activity, or if it is the first call,
+ * call sync_old_buffers()
+ */
+ if (activity || disk_activity[0] == 0)
+ {
+#ifdef DEBUG
+ printk("kmobile-update calls sync\n");
+#endif
+ sync_old_buffers();
+
+ /* remember disk status for next call */
+ for (dsk=0; dsk<DK_NDRIVE; dsk++)
+ disk_activity[dsk] = kstat.dk_drive[dsk];
+ }
+#ifdef DEBUG
+ else
+ printk("kmobile-update ignores sync()\n");
+#endif
+#else
sync_old_buffers();
+#endif
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/