Skip to contentSkip to conversation

Make page-writeback timers 1 sec jiffy aligned

PATCH In review Venki Pallipadi 2 participants 2 messages May 29, 2007 – May 30, 2007

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

PATCH 2/4 Make page-writeback timers 1 sec jiffy aligned

timer round_jiffies in page-writeback.

mm/page-writeback.c +6 -5
Index: linux-2.6.22-rc-mm/mm/page-writeback.c
===================================================================
@@ -469,7 +469,7 @@
 	if (time_before(next_jif, jiffies + HZ))
 		next_jif = jiffies + HZ;
 	if (dirty_writeback_interval)
-		mod_timer(&wb_timer, next_jif);
+		mod_timer(&wb_timer, round_jiffies(next_jif));
 }
 
 /*
@@ -481,7 +481,7 @@
 	proc_dointvec_userhz_jiffies(table, write, file, buffer, length, ppos);
 	if (dirty_writeback_interval) {
 		mod_timer(&wb_timer,
-			jiffies + dirty_writeback_interval);
+			round_jiffies(jiffies + dirty_writeback_interval));
 		} else {
 		del_timer(&wb_timer);
 	}
@@ -491,7 +491,8 @@
 static void wb_timer_fn(unsigned long unused)
 {
 	if (pdflush_operation(wb_kupdate, 0) < 0)
-		mod_timer(&wb_timer, jiffies + HZ); /* delay 1 second */
+		mod_timer(&wb_timer, round_jiffies(jiffies + HZ));
+		/* delay 1 second */
 }
 
 static void laptop_flush(unsigned long unused)
@@ -511,7 +512,7 @@
  */
 void laptop_io_completion(void)
 {
-	mod_timer(&laptop_mode_wb_timer, jiffies + laptop_mode);
+	mod_timer(&laptop_mode_wb_timer, round_jiffies(jiffies + laptop_mode));
 }
 
 /*
@@ -582,7 +583,7 @@
  */
 void __init page_writeback_init(void)
 {
-	mod_timer(&wb_timer, jiffies + dirty_writeback_interval);
+	mod_timer(&wb_timer, round_jiffies(jiffies + dirty_writeback_interval));
 	writeback_set_ratelimit();
 	register_cpu_notifier(&ratelimit_nb);
 }
maintainer
#1 lore raw
Quoted 20 lines · On Tue, 29 May 2007 10:59:51 -0700 Venki Pallipadi…

timer round_jiffies in page-writeback.

Index: linux-2.6.22-rc-mm/mm/page-writeback.c
===================================================================

mm/page-writeback.c +1 -1
@@ -469,7 +469,7 @@
 	if (time_before(next_jif, jiffies + HZ))
 		next_jif = jiffies + HZ;
 	if (dirty_writeback_interval)
-		mod_timer(&wb_timer, next_jif);
+		mod_timer(&wb_timer, round_jiffies(next_jif));
 }
 
 /*

mm/page-writeback.c line 487

Quoted 8 lines
mm/page-writeback.c +1 -1
@@ -481,7 +481,7 @@
 	proc_dointvec_userhz_jiffies(table, write, file, buffer, length, ppos);
 	if (dirty_writeback_interval) {
 		mod_timer(&wb_timer,
-			jiffies + dirty_writeback_interval);
+			round_jiffies(jiffies + dirty_writeback_interval));
 		} else {
 		del_timer(&wb_timer);
 	}

mutter.

These tunables are in units of centiseconds, so the user can indeed set the writeback interval to, say, 0.2 seconds. People have played with that sort of thing.

I doubt if this patch will hurt anyone much, but it is an incompatible user-visible change.

Probably a suitable heuristic for fixing this would be to only do the rounding if dirty_writeback_interval is a multiple of HZ. In the vast majority of cases, that will be true.