From 7f8bb428d3023448145199c3a41243d666afe253 Mon Sep 17 00:00:00 2001 From: Juhyung Park Date: Wed, 31 May 2023 23:59:23 +0900 Subject: [PATCH] sysctl: tune dirty data writeback policies (#135) The existing policy sets dirty_background_bytes to 5, which is erroneously too small that incurs write amplification and read starvations. Considering a raspi with 2 GiB of RAM, this is 43 million times smaller than the default Linux policy, which is 10%. Considering that this will be deployed to mostly read-only system with emphasis on data integrity (hence needing tighter data writeback), set this to 256 KiB. Continuing addressing the overly excessive data writeback policies, also bump the dirty_writeback_centisecs from 250ms to 1000ms. Any dirty data written in the past 1 second will be written to the storage. Signed-off-by: Juhyung Park --- configs/os/sysctl.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configs/os/sysctl.conf b/configs/os/sysctl.conf index 7cfe43b0..abe53aa6 100644 --- a/configs/os/sysctl.conf +++ b/configs/os/sysctl.conf @@ -1,6 +1,7 @@ -# https://github.com/raspberrypi/linux/issues/1753 -vm.dirty_background_bytes = 5 -vm.dirty_writeback_centisecs = 25 +# Overly-aggressive data writeback policies to minimize the chance of data corruption +# Start dirty data writeback when it exceeds 256 KiB or 1s has passed +vm.dirty_background_bytes = 262144 +vm.dirty_writeback_centisecs = 100 # https://groups.google.com/g/meetecho-janus/c/xoWIQfaoJm8 net.core.rmem_default = 500000