[PATCH] Represent laptop_mode as jiffies internally
authorBart Samwel <bart@samwel.tk>
Fri, 24 Mar 2006 11:15:49 +0000 (03:15 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 24 Mar 2006 15:33:20 +0000 (07:33 -0800)
Make that the internal value for /proc/sys/vm/laptop_mode is stored as
jiffies instead of seconds.  Let the sysctl interface do the conversions,
instead of doing on-the-fly conversions every time the value is used.

Add a description of the fact that laptop_mode doubles as a flag and a
timeout to the comment above the laptop_mode variable.

Signed-off-by: Bart Samwel <bart@samwel.tk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sysctl.c
mm/page-writeback.c

index 817ba25517ebe71ad0166735d8b8bed3a36a375c..d13426680d10128f7e01d452c8257eedb905fab8 100644 (file)
@@ -848,9 +848,8 @@ static ctl_table vm_table[] = {
                .data           = &laptop_mode,
                .maxlen         = sizeof(laptop_mode),
                .mode           = 0644,
-               .proc_handler   = &proc_dointvec,
-               .strategy       = &sysctl_intvec,
-               .extra1         = &zero,
+               .proc_handler   = &proc_dointvec_jiffies,
+               .strategy       = &sysctl_jiffies,
        },
        {
                .ctl_name       = VM_BLOCK_DUMP,
index e79107991d20e59fb1482852cd7513ff0da6b89d..c1052ee79f01096d6dfe23f8d1021c80216b3ad5 100644 (file)
@@ -88,7 +88,8 @@ int dirty_expire_interval = 30 * HZ;
 int block_dump;
 
 /*
- * Flag that puts the machine in "laptop mode".
+ * Flag that puts the machine in "laptop mode". Doubles as a timeout in jiffies:
+ * a full sync is triggered after this time elapses without any disk activity.
  */
 int laptop_mode;
 
@@ -468,7 +469,7 @@ static void laptop_timer_fn(unsigned long unused)
  */
 void laptop_io_completion(void)
 {
-       mod_timer(&laptop_mode_wb_timer, jiffies + laptop_mode * HZ);
+       mod_timer(&laptop_mode_wb_timer, jiffies + laptop_mode);
 }
 
 /*