Skip to contentSkip to conversation

kernel 2.6.5-mm1 : laptop-mode

PATCH In review Angelo Dell'Aera 2 participants 3 messages Apr 5, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel 2.6.5-mm1 : laptop-mode

After upgrading to 2.6.5-mm1 I noticed the script laptop_mode failed to initiliaze laptop mode. It is due to the new position of the sysctl laptop_mode under /proc. This is an update to the documentation (and the script). Please apply.

Regards.

--

Angelo Dell'Aera 'buffer'
Antifork Research, Inc. http://buffer.antifork.org

Documentation/laptop-mode.txt renamed from Documentation/laptop-mode.txt.old +6 -6
@@ -80,7 +80,7 @@
 The details
 -----------
 
-Laptop-mode is controlled by the flag /proc/sys/vm/laptop_mode. When this
+Laptop-mode is controlled by the flag /proc/sys/fs/laptop_mode. When this
 flag is set, any physical disk read operation (that might have caused the
 hard disk to spin up) causes Linux to flush all dirty blocks. The result
 of this is that after a disk has spun down, it will not be spun up anymore
@@ -321,12 +321,12 @@
 # like the rest of the external world. Unfortunately this cannot be automated. :(
 XFS_HZ=1000
 
-if [ ! -e /proc/sys/vm/laptop_mode ]; then
+if [ ! -e /proc/sys/fs/laptop_mode ]; then
 	echo "Kernel is not patched with laptop_mode patch."
 	exit 1
 fi
 
-if [ ! -w /proc/sys/vm/laptop_mode ]; then
+if [ ! -w /proc/sys/fs/laptop_mode ]; then
 	echo "You do not have enough privileges to enable laptop_mode."
 	exit 1
 fi
@@ -355,11 +355,11 @@
 
 		case "$KLEVEL" in
 			"2.4")
-				echo "1"				> /proc/sys/vm/laptop_mode
+				echo "1"				> /proc/sys/fs/laptop_mode
 				echo "30 500 0 0 $AGE $AGE 60 20 0"	> /proc/sys/vm/bdflush
 				;;
 			"2.6")
-				echo "5"				> /proc/sys/vm/laptop_mode
+				echo "5"				> /proc/sys/fs/laptop_mode
 				echo "$AGE"				> /proc/sys/vm/dirty_writeback_centisecs
 				echo "$AGE"				> /proc/sys/vm/dirty_expire_centisecs
 				echo "$DIRTY_RATIO"			> /proc/sys/vm/dirty_ratio
@@ -389,7 +389,7 @@
 		U_AGE=$((100*$DEF_UPDATE))
 		B_AGE=$((100*$DEF_AGE))
 		echo -n "Stopping laptop_mode"
-		echo "0" > /proc/sys/vm/laptop_mode
+		echo "0" > /proc/sys/fs/laptop_mode
 		if [ -f /proc/sys/fs/xfs/age_buffer ] && [ ! -f /proc/sys/fs/xfs/lm_age_buffer ] ; then
 			# These need to be restored though, if there are no lm_*.
 			echo "$(($XFS_HZ*$DEF_XFS_AGE_BUFFER))" 	> /proc/sys/fs/xfs/age_buffer
#1 lore raw

Documentation/laptop-mode.txt line 83

Quoted 9 lines · Angelo Dell'Aera

After upgrading to 2.6.5-mm1 I noticed the script laptop_mode failed to initiliaze laptop mode. It is due to the new position of the sysctl laptop_mode under /proc. This is an update to the documentation (and the script). Please apply.
...

Documentation/laptop-mode.txt renamed from Documentation/laptop-mode.txt.old +1 -1
-Laptop-mode is controlled by the flag /proc/sys/vm/laptop_mode. When this
+Laptop-mode is controlled by the flag /proc/sys/fs/laptop_mode. When this

erk. No, that was not intended. Looks like `patch' decided to move some code around for me. I'll fix that up, thanks. laptop_mode shall remain in /proc/sys/vm/

#2 lore raw
Quoted 8 lines · On Mon, 5 Apr 2004 14:52:09 -0700 Andrew Morton <[email protected]> wrote:
Quoted 7 lines · Angelo Dell'Aera

After upgrading to 2.6.5-mm1 I noticed the script laptop_mode failed to initiliaze laptop mode. It is due to the new position of the sysctl laptop_mode under /proc. This is an update to the documentation (and the script). Please apply.
...

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-Laptop-mode is controlled by the flag /proc/sys/vm/laptop_mode. When this
+Laptop-mode is controlled by the flag /proc/sys/fs/laptop_mode. When this

erk. No, that was not intended. Looks like `patch' decided to move some code around for me. I'll fix that up, thanks. laptop_mode shall remain in /proc/sys/vm/

OK. Attached a patch which addresses this matter.

Regards.

--

Angelo Dell'Aera 'buffer'
Antifork Research, Inc. http://buffer.antifork.org

kernel/sysctl.c renamed from kernel/sysctl.c.old +20 -20
@@ -744,6 +744,26 @@
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec
 	},
+	{
+		.ctl_name	= VM_LAPTOP_MODE,
+		.procname	= "laptop_mode",
+		.data		= &laptop_mode,
+		.maxlen		= sizeof(laptop_mode),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &zero,
+	},
+	{
+		.ctl_name	= VM_BLOCK_DUMP,
+		.procname	= "block_dump",
+		.data		= &block_dump,
+		.maxlen		= sizeof(block_dump),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+		.strategy	= &sysctl_intvec,
+		.extra1		= &zero,
+	},
 	{ .ctl_name = 0 }
 };
 
@@ -854,26 +874,6 @@
 		.mode		= 0644,
 		.proc_handler	= &proc_dointvec,
 	},
-	{
-		.ctl_name	= VM_LAPTOP_MODE,
-		.procname	= "laptop_mode",
-		.data		= &laptop_mode,
-		.maxlen		= sizeof(laptop_mode),
-		.mode		= 0644,
-		.proc_handler	= &proc_dointvec,
-		.strategy	= &sysctl_intvec,
-		.extra1		= &zero,
-	},
-	{
-		.ctl_name	= VM_BLOCK_DUMP,
-		.procname	= "block_dump",
-		.data		= &block_dump,
-		.maxlen		= sizeof(block_dump),
-		.mode		= 0644,
-		.proc_handler	= &proc_dointvec,
-		.strategy	= &sysctl_intvec,
-		.extra1		= &zero,
-	},
 	{ .ctl_name = 0 }
 };