Vm.dirty_ratio and vm.dirty_background_ratio

Can anyone explain me about vm.dirty_ration and vm.dirty_background_ratio in layman terms and whats the difference between this two parameters? I know both are writing the data from RAM to disk for better performance but I am not sure about the difference between this two parameters.

The background one is a permanent flush thread in the kernel that regularly checks and executes if above threshold.
The other one is checked and eventually ececuted when a process allocates memory. In case it executes it causes a delay in that process.

Thanks and You mean to say lock will happen on I/O until the process writes the data between RAM and the disk in the dirty_ratio. Am I understanding correct?

Yes, the process is locked in D state until the kernel has flushed enough RAM cache to disk.

1 Like