title: Why linux disables disk write buffer when system ram is greater than 8GB?
body: <p><strong>Background:</strong></p>
  
  <p>I was trying to setup a <code>ubuntu</code> machine on my desktop computer. The whole process took a whole day, including installing OS and softwares. I didn't thought much about it, though.</p>
  
  <p>Then I tried doing my work using the new machine, and it was significantly slower than my laptop, which is very strange.</p>
  
  <p>I did <code>iotop</code> and found that disk traffic when decompressing a package is around 1-2MB/s, and it's definitely abnormal. </p>
  
  <p>Then, after hours of research, I found <a href="https://fhackts.wordpress.com/2014/03/10/very-slow-disk-write-performance-linux/" rel="noreferrer">this article</a> that describes exactly same problem, and provided a ugly solution:</p>
  
  <blockquote>
    <p><strong>We recently had a major performance issue on some systems, where disk write speed is extremely slow (~1 MB/s — where normal performance
    is 150+MB/s).</strong></p>
    
    <p>...</p>
    
    <p><em>EDIT: to solve this, <strong>either remove enough RAM, or add “mem=8G” as kernel boot parameter</strong> (e.g. in /etc/default/grub on Ubuntu — don’t
    forget to run update-grub !)</em></p>
  </blockquote>
  
  <p>I also looked at this post</p>
  
  <p><a href="https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/" rel="noreferrer">https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/</a></p>
  
  <p>and did </p>
  
  <pre><code>cat /proc/vmstat | egrep "dirty|writeback"
  </code></pre>
  
  <p>output is:</p>
  
  <pre><code>nr_dirty 10
  nr_writeback 0
  nr_writeback_temp 0  
  nr_dirty_threshold 0  // and here
  nr_dirty_background_threshold 0 // here
  </code></pre>
  
  <p>those values were <code>8223</code> and <code>4111</code> when <code>mem=8g</code> is set.</p>
  
  <p>So, it's basically showing that <strong>when system memory is greater than 8GB</strong> (32GB in my case), regardless of  <code>vm.dirty_background_ratio</code> and <code>vm.dirty_ratio</code> settings, (5% and 10% in my case), the <strong>actual dirty threshold goes to 0</strong> and write buffer is disabled?</p>
  
  <p>Why is this happening?</p>
  
  <p>Is this a bug in the kernel or somewhere else?</p>
  
  <p>Is there a solution other than unplugging RAM or using "mem=8g"?</p>
  
  <p><strong>UPDATE:</strong> I'm running 3.13.0-53-generic kernel with ubuntu 12.04 32-bit, so it's possible that this only happens on 32-bit systems.</p>