Skip to contentSkip to conversation

laptop mode in 2.4.24

DISCUSSION Cristiano De Michele 4 participants 5 messages Feb 20, 2004 – Feb 24, 2004 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,
I had kernel 2.4.22-ac4 + laptop mode patch and it worked perfectly.
Now I'm on a 2.4.24 kernel where the aforementioned patch has been merged in, but it seems
that it does not work properly,
I've set bdflush as follows:

cat /proc/sys/vm/bdflush
30 500 0 0 60000 60000 60 20 0

cat /proc/sys/vm/laptop_mode
1

and using
echo "1" > cat /proc/sys/vm/block_dump

in syslog there are only such messages:

.
.
.

Feb 20 11:31:17 piro kernel: kjournald: WRITE block 46640/8 on 03:05
Feb 20 11:31:17 piro kernel: kjournald: WRITE block 46648/8 on 03:05

.
.
.

that is only journaling is writing to my HD
and anyway every minute more or less something gets written to HD preventing it from being spinned down

thx Cristiano

Signature · 2 lines
Cristiano De Michele <[email protected]>
Department of Physics, University of Naples "Federico II"
#1 lore raw
Quoted 3 lines · Cristiano De Michele

that is only journaling is writing to my HD
and anyway every minute more or less something gets written to HD preventing it from being spinned down

IIRC, laptop-mode included in mainline 2.4 does not reset commit interval of ext3 filesystems (as surely did the patch you applied to older kernels).

You need to remount your filesystems with appropate commit option. You can see the updated control script that's in 2.6.*-mm* trees.

Signature · 1 line
Kiko
#2 lore raw
Quoted 6 lines · Kiko Piris
Quoted 3 lines · Cristiano De Michele

that is only journaling is writing to my HD
and anyway every minute more or less something gets written to HD preventing it from being spinned down

Quoted 6 lines

IIRC, laptop-mode included in mainline 2.4 does not reset commit interval of ext3 filesystems (as surely did the patch you applied to older kernels).

You need to remount your filesystems with appropate commit option. You can see the updated control script that's in 2.6.*-mm* trees.

Or use this patch...

fs/jbd/transaction.c +5 -1
diff -ruN linux-2.4.24.orig/fs/jbd/transaction.c linux-2.4.24/fs/jbd/transaction.c
@@ -56,7 +56,11 @@
 	transaction->t_journal = journal;
 	transaction->t_state = T_RUNNING;
 	transaction->t_tid = journal->j_transaction_sequence++;
-	transaction->t_expires = jiffies + journal->j_commit_interval;
+	/*
+	 * have to do it here, otherwise changed age_buffers since boot
+	 * wont have any effect
+	 */
+	transaction->t_expires = jiffies + get_buffer_flushtime();
 	INIT_LIST_HEAD(&transaction->t_jcb);
 
 	/* Set up the commit timer for the new transaction. */

Phil.

#3 lore raw
Quoted 4 lines · Philippe Troin
Quoted 2 lines · Kiko Piris

On 20/02/2004 at 12:32, Cristiano De Michele wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

that is only journaling is writing to my HD
and anyway every minute more or less something gets written to HD preventing it from being spinned down

IIRC, laptop-mode included in mainline 2.4 does not reset commit interval of ext3 filesystems (as surely did the patch you applied to older kernels).

Yes, there was a bug with the version included in the official kernel that it updates the value in the wrong place.

Quoted 3 lines
Quoted 2 lines

You need to remount your filesystems with appropate commit option. You can see the updated control script that's in 2.6.*-mm* trees.

There is one problem with the commit option that you have to reset the default option manually because there is currently no reset option (you need to change the script to do a commit=30 when leaving laptop mode).

Quoted 2 lines

Or use this patch...

The problem with this patch is that it overrides the built in commit option that existed before the laptop mode patch was introduced.

Quoted 19 lines

diff -ruN linux-2.4.24.orig/fs/jbd/transaction.c linux-2.4.24/fs/jbd/transaction.c

fs/jbd/transaction.c +5 -1
@@ -56,7 +56,11 @@
 	transaction->t_journal = journal;
 	transaction->t_state = T_RUNNING;
 	transaction->t_tid = journal->j_transaction_sequence++;
-	transaction->t_expires = jiffies + journal->j_commit_interval;
+	/*
+	 * have to do it here, otherwise changed age_buffers since boot
+	 * wont have any effect
+	 */
+	transaction->t_expires = jiffies + get_buffer_flushtime();
 	INIT_LIST_HEAD(&transaction->t_jcb);
 
 	/* Set up the commit timer for the new transaction. */

Phil.

#5 lore raw
In reply to a message not in the archive
Quoted 20 lines · Eric Hustvedt
Quoted 18 lines · Micha Feigin

The problem with this patch is that it overrides the built in commit option that existed before the laptop mode patch was introduced.

Quoted 15 lines

diff -ruN linux-2.4.24.orig/fs/jbd/transaction.c linux-2.4.24/fs/jbd/transaction.c

fs/jbd/transaction.c +5 -1
@@ -56,7 +56,11 @@
 	transaction->t_journal = journal;
 	transaction->t_state = T_RUNNING;
 	transaction->t_tid = journal->j_transaction_sequence++;
-	transaction->t_expires = jiffies + journal->j_commit_interval;
+	/*
+	 * have to do it here, otherwise changed age_buffers since boot
+	 * wont have any effect
+	 */
+	transaction->t_expires = jiffies + get_buffer_flushtime();
 	INIT_LIST_HEAD(&transaction->t_jcb);
 
Quoted 9 lines
Quoted 1 line

fs/jbd/transaction.c line 66

Quoted 1 line
fs/jbd/transaction.c +0 -0
 	/* Set up the commit timer for the new transaction. */

What about changing the logic to use the greater of get_buffer_flushtime() or j_commit_interval when laptop_mode is enabled? If laptop_mode is disabled, j_commit_interval can be used, as it is currently.

I don't have my kernel dev trees on this computer, but I can whip up a patch, if people are interested.

Considering that this was somewhat of a dirty hack in the first place, that ext3 already has the functionality through the commit mount option and that 2.6 laptop mode I think the proper way would be to throw this out and use the commit option instead. All it needs is the reset option (use commit=0 to use the default file system value). This way among other things it will be possible to use the same laptop mode script for both 2.4 and 2.6.
I have a patch for that which is in a testing phase now (along with a fix for reiserfs and xfs), I am a bit slow on it now due to test season but I am hoping to publish it next week or something around that. I will check with the guy doing the 2.6 laptop-mode patch to see whats the state of the testing.

Quoted 1 line

-Eric