Skip to contentSkip to conversation

writeback tunables

PATCH In review Andrew Morton 4 participants 5 messages Jun 17, 2002 – Jun 18, 2002

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

PATCH 1/19 writeback tunables

Adds five sysctls for tuning the writeback behaviour:

dirty_async_ratio
dirty_background_ratio
dirty_sync_ratio
dirty_expire_centisecs
dirty_writeback_centisecs

these are described in Documentation/filesystems/proc.txt They are basically the tradiditional knobs which we've always had...

We are accreting a ton of obsolete sysctl numbers under /proc/sys/vm/. I didn't recycle these - just mark them unused and remove the obsolete documentation.

include/linux/sysctl.h renamed from include/linux/sysctl.h~pdflush-sysctl +12 -7
@@ -130,16 +130,21 @@ enum
 /* CTL_VM names: */
 enum
 {
-	VM_SWAPCTL=1,		/* struct: Set vm swapping control */
-	VM_SWAPOUT=2,		/* int: Linear or sqrt() swapout for hogs */
-	VM_FREEPG=3,		/* struct: Set free page thresholds */
+	VM_UNUSED1=1,		/* was: struct: Set vm swapping control */
+	VM_UNUSED2=2,		/* was; int: Linear or sqrt() swapout for hogs */
+	VM_UNUSED3=3,		/* was: struct: Set free page thresholds */
 	VM_BDFLUSH_UNUSED=4,	/* Spare */
 	VM_OVERCOMMIT_MEMORY=5,	/* Turn off the virtual memory safety limit */
-	VM_BUFFERMEM=6,		/* struct: Set buffer memory thresholds */
-	VM_PAGECACHE=7,		/* struct: Set cache memory thresholds */
+	VM_UNUSED4=6,		/* was: struct: Set buffer memory thresholds */
+	VM_UNUSED5=7,		/* was: struct: Set cache memory thresholds */
 	VM_PAGERDAEMON=8,	/* struct: Control kswapd behaviour */
-	VM_PGT_CACHE=9,		/* struct: Set page table cache parameters */
-	VM_PAGE_CLUSTER=10	/* int: set number of pages to swap together */
+	VM_UNUSED6=9,		/* was: struct: Set page table cache parameters */
+	VM_PAGE_CLUSTER=10,	/* int: set number of pages to swap together */
+	VM_DIRTY_BACKGROUND=11,	/* dirty_background_ratio */
+	VM_DIRTY_ASYNC=12,	/* dirty_async_ratio */
+	VM_DIRTY_SYNC=13,	/* dirty_sync_ratio */
+	VM_DIRTY_WB_CS=14,	/* dirty_writeback_centisecs */
+	VM_DIRTY_EXPIRE_CS=15,	/* dirty_expire_centisecs */
 };
 
 
kernel/sysctl.c renamed from kernel/sysctl.c~pdflush-sysctl +14 -0
@@ -31,6 +31,7 @@
 #include <linux/init.h>
 #include <linux/sysrq.h>
 #include <linux/highuid.h>
+#include <linux/writeback.h>
 
 #include <asm/uaccess.h>
 
@@ -264,6 +265,19 @@ static ctl_table vm_table[] = {
 	 &pager_daemon, sizeof(pager_daemon_t), 0644, NULL, &proc_dointvec},
 	{VM_PAGE_CLUSTER, "page-cluster", 
 	 &page_cluster, sizeof(int), 0644, NULL, &proc_dointvec},
+	{VM_DIRTY_BACKGROUND, "dirty_background_ratio",
+	&dirty_background_ratio, sizeof(dirty_background_ratio),
+	0644, NULL, &proc_dointvec},
+	{VM_DIRTY_ASYNC, "dirty_async_ratio", &dirty_async_ratio,
+	sizeof(dirty_async_ratio), 0644, NULL, &proc_dointvec},
+	{VM_DIRTY_SYNC, "dirty_sync_ratio", &dirty_sync_ratio,
+	sizeof(dirty_sync_ratio), 0644, NULL, &proc_dointvec},
+	{VM_DIRTY_WB_CS, "dirty_writeback_centisecs",
+	&dirty_writeback_centisecs, sizeof(dirty_writeback_centisecs), 0644,
+	NULL, &proc_dointvec},
+	{VM_DIRTY_EXPIRE_CS, "dirty_expire_centisecs",
+	&dirty_expire_centisecs, sizeof(dirty_expire_centisecs), 0644,
+	NULL, &proc_dointvec},
 	{0}
 };
 
mm/page-writeback.c renamed from mm/page-writeback.c~pdflush-sysctl +42 -26

132 lines not on this page · raw message

include/linux/writeback.h renamed from include/linux/writeback.h~pdflush-sysctl +6 -0
@@ -45,6 +45,12 @@ static inline void wait_on_inode(struct 
 /*
  * mm/page-writeback.c
  */
+extern int dirty_background_ratio;
+extern int dirty_async_ratio;
+extern int dirty_sync_ratio;
+extern int dirty_writeback_centisecs;
+extern int dirty_expire_centisecs;
+
 void balance_dirty_pages(struct address_space *mapping);
 void balance_dirty_pages_ratelimited(struct address_space *mapping);
 int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0);
Documentation/filesystems/proc.txt renamed from Documentation/filesystems/proc.txt~pdflush-sysctl +32 -182

231 lines not on this page · raw message

Documentation/sysctl/vm.txt renamed from Documentation/sysctl/vm.txt~pdflush-sysctl +10 -133

164 lines not on this page · raw message

-

#1 lore raw

mm/page-writeback.c line 78

Quoted 10 lines

+ * The interval between `kupdate'-style writebacks.
+ */

mm/page-writeback.c renamed from mm/page-writeback.c~pdflush-sysctl +7 -0
+int dirty_writeback_centisecs = 5 * 100;
+
+/*
+ * The largest amount of time for which data is allowed to remain dirty
+ */
+int dirty_expire_centisecs = 30 * 100;
+

Blind guess - didn't the 100 wan't to be HZ?!

#2 lore raw
Quoted 12 lines · Martin Dalecki

mm/page-writeback.c line 78

Quoted 10 lines

+ * The interval between `kupdate'-style writebacks.
+ */

mm/page-writeback.c renamed from mm/page-writeback.c~pdflush-sysctl +7 -0
+int dirty_writeback_centisecs = 5 * 100;
+
+/*
+ * The largest amount of time for which data is allowed to remain dirty
+ */
+int dirty_expire_centisecs = 30 * 100;
+

Blind guess - didn't the 100 wan't to be HZ?!

The units are centiseconds (as the name suggests). 5 * 100 centiseconds = 5 seconds, so the dirty writeback timeout is 5 seconds. Check the code a little further and you'll see HZ gets factored into them on use.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#3 lore raw
Quoted 12 lines · Russell King

On Mon, Jun 17, 2002 at 12:33:18PM +0200, Martin Dalecki wrote:
...

Quoted 4 lines

mm/page-writeback.c line 78

Quoted 2 lines
mm/page-writeback.c renamed from mm/page-writeback.c~pdflush-sysctl +2 -0
+int dirty_expire_centisecs = 30 * 100;
+

Blind guess - didn't the 100 wan't to be HZ?!

The units are centiseconds (as the name suggests). 5 * 100 centiseconds = 5 seconds, so the dirty writeback timeout is 5 seconds. Check the code a little further and you'll see HZ gets factored into them on use.

Yup. Sorry about the "_centisecs" thing. That's a bit anal, but I tend to think that it's best to be really explicit about the units, make it a bit easier to use. I don't know how many times I've had to peer in fs/buffer.c to remember what those dang numbers do.

Possibly, "seconds" may be sufficiently high resolution for these things. But I wasn't sure - maybe someone wants to run the kupdate function five times per second? Dunno.

There are some departures from 2.4 tradition which are worth mentioning here:

- There is no range checking on the settings. (But a divide-by zero isn't possible, so I think that's OK)

- Unlike the 2.4 bdflush settings, these parameters are not updated in a single hit. So if you modify them by a large amount while the system is under heavy writeback load, perhaps some whacky things will happen if you create an irrational intermediate state. But that's quite unlikely.

- Unlike 2.4, the settings are scaled by HZ. So that bdflush tuning tool whose name I forget will no longer make kupdate run ten times too fast on Alphas.

-

#4 lore raw
Quoted 14 lines · Andrew Morton
Quoted 12 lines · Russell King

On Mon, Jun 17, 2002 at 12:33:18PM +0200, Martin Dalecki wrote:
...

Quoted 4 lines

mm/page-writeback.c line 78

Quoted 2 lines
mm/page-writeback.c renamed from mm/page-writeback.c~pdflush-sysctl +2 -0
+int dirty_expire_centisecs = 30 * 100;
+

Blind guess - didn't the 100 wan't to be HZ?!

The units are centiseconds (as the name suggests). 5 * 100 centiseconds = 5 seconds, so the dirty writeback timeout is 5 seconds. Check the code a little further and you'll see HZ gets factored into them on use.

Quoted 8 lines

Yup. Sorry about the "_centisecs" thing. That's a bit anal, but I tend to think that it's best to be really explicit about the units, make it a bit easier to use. I don't know how many times I've had to peer in fs/buffer.c to remember what those dang numbers do.

Possibly, "seconds" may be sufficiently high resolution for these things. But I wasn't sure - maybe someone wants to run the kupdate function five times per second? Dunno.

Possibly, we should just concede that anywhere where we're measuring time, we'll eventually want to use a non-integer external representation just so we're not building in obsolescense. With a couple simple wrappers like atoif(".667",HZ)=67, this could be pretty painless.

Signature · 1 line
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.."