public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] Represent laptop_mode as jiffies internally
@ 2006-01-28  2:47 Bart Samwel
  0 siblings, 0 replies; only message in thread
From: Bart Samwel @ 2006-01-28  2:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel



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>

--- linux-2.6.16-rc1.orig/kernel/sysctl.c	2006-01-28 02:09:32.000000000 +0100
+++ linux-2.6.16-rc1/kernel/sysctl.c	2006-01-28 02:13:10.000000000 +0100
@@ -823,9 +823,8 @@
  		.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,
--- linux-2.6.16-rc1.orig/mm/page-writeback.c	2006-01-28 01:47:24.000000000 +0100
+++ linux-2.6.16-rc1/mm/page-writeback.c	2006-01-28 02:11:52.000000000 +0100
@@ -88,7 +88,8 @@
  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;

@@ -467,7 +468,7 @@
   */
  void laptop_io_completion(void)
  {
-	mod_timer(&laptop_mode_wb_timer, jiffies + laptop_mode * HZ);
+	mod_timer(&laptop_mode_wb_timer, jiffies + laptop_mode);
  }

  /*

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-28  2:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-28  2:47 [PATCH 2/3] Represent laptop_mode as jiffies internally Bart Samwel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox