I see writeback cache (`dirty`) converge to less than dirty_background_ratio. Why?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I tested Linux 4.18.16-200.fc28.x86_64, with 7.7G total RAM (free -h).



I have default vm.dirty* settings. dirty_background_ratio is 10, and dirty_ratio is 20.



This means Linux should begin writeout of dirty cache when it reaches 10% of RAM: 0.77G. Writers should block if it reaches 20% of RAM: 1.54G. Between those values, I believe that write() calls are supposed to be throttled (delayed) on a curve, to keep the dirty cache near a "setpoint" which is half-way in between: 1.155G.



  • https://github.com/torvalds/linux/blob/v4.18/Documentation/sysctl/vm.txt

  • No-I/O dirty throttling - LWN.net

  • (dirty_background_ratio + dirty_ratio)/2 dirty data in
    total ... is an amount of dirty data when we start to throttle
    processes

I ran dd if=/dev/zero bs=1M of=~/test, and watched the dirty field in atop.



I saw dirty fluctuate pretty close to 0.5G. Never mind the "setpoint", this is even less than the dirty background threshold (0.77G)! How can this be? It is absolutely not what I would expect, based on the above documents. What am I missing?



dirty_expire_centisecs is 30000, so I don't think that can be the cause. I even tried lowering dirty_expire_centisecs to 100, and dirty_writeback_centisecs to 10, to see if that was limiting dirty. This did not change the result.



I initially wrote these observations as part of my post here: Why were "USB-stick stall" problems reported in 2013? Why wasn't this problem solved by the existing "No-I/O dirty throttling" code?









share



























    up vote
    0
    down vote

    favorite












    I tested Linux 4.18.16-200.fc28.x86_64, with 7.7G total RAM (free -h).



    I have default vm.dirty* settings. dirty_background_ratio is 10, and dirty_ratio is 20.



    This means Linux should begin writeout of dirty cache when it reaches 10% of RAM: 0.77G. Writers should block if it reaches 20% of RAM: 1.54G. Between those values, I believe that write() calls are supposed to be throttled (delayed) on a curve, to keep the dirty cache near a "setpoint" which is half-way in between: 1.155G.



    • https://github.com/torvalds/linux/blob/v4.18/Documentation/sysctl/vm.txt

    • No-I/O dirty throttling - LWN.net

    • (dirty_background_ratio + dirty_ratio)/2 dirty data in
      total ... is an amount of dirty data when we start to throttle
      processes

    I ran dd if=/dev/zero bs=1M of=~/test, and watched the dirty field in atop.



    I saw dirty fluctuate pretty close to 0.5G. Never mind the "setpoint", this is even less than the dirty background threshold (0.77G)! How can this be? It is absolutely not what I would expect, based on the above documents. What am I missing?



    dirty_expire_centisecs is 30000, so I don't think that can be the cause. I even tried lowering dirty_expire_centisecs to 100, and dirty_writeback_centisecs to 10, to see if that was limiting dirty. This did not change the result.



    I initially wrote these observations as part of my post here: Why were "USB-stick stall" problems reported in 2013? Why wasn't this problem solved by the existing "No-I/O dirty throttling" code?









    share

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I tested Linux 4.18.16-200.fc28.x86_64, with 7.7G total RAM (free -h).



      I have default vm.dirty* settings. dirty_background_ratio is 10, and dirty_ratio is 20.



      This means Linux should begin writeout of dirty cache when it reaches 10% of RAM: 0.77G. Writers should block if it reaches 20% of RAM: 1.54G. Between those values, I believe that write() calls are supposed to be throttled (delayed) on a curve, to keep the dirty cache near a "setpoint" which is half-way in between: 1.155G.



      • https://github.com/torvalds/linux/blob/v4.18/Documentation/sysctl/vm.txt

      • No-I/O dirty throttling - LWN.net

      • (dirty_background_ratio + dirty_ratio)/2 dirty data in
        total ... is an amount of dirty data when we start to throttle
        processes

      I ran dd if=/dev/zero bs=1M of=~/test, and watched the dirty field in atop.



      I saw dirty fluctuate pretty close to 0.5G. Never mind the "setpoint", this is even less than the dirty background threshold (0.77G)! How can this be? It is absolutely not what I would expect, based on the above documents. What am I missing?



      dirty_expire_centisecs is 30000, so I don't think that can be the cause. I even tried lowering dirty_expire_centisecs to 100, and dirty_writeback_centisecs to 10, to see if that was limiting dirty. This did not change the result.



      I initially wrote these observations as part of my post here: Why were "USB-stick stall" problems reported in 2013? Why wasn't this problem solved by the existing "No-I/O dirty throttling" code?









      share















      I tested Linux 4.18.16-200.fc28.x86_64, with 7.7G total RAM (free -h).



      I have default vm.dirty* settings. dirty_background_ratio is 10, and dirty_ratio is 20.



      This means Linux should begin writeout of dirty cache when it reaches 10% of RAM: 0.77G. Writers should block if it reaches 20% of RAM: 1.54G. Between those values, I believe that write() calls are supposed to be throttled (delayed) on a curve, to keep the dirty cache near a "setpoint" which is half-way in between: 1.155G.



      • https://github.com/torvalds/linux/blob/v4.18/Documentation/sysctl/vm.txt

      • No-I/O dirty throttling - LWN.net

      • (dirty_background_ratio + dirty_ratio)/2 dirty data in
        total ... is an amount of dirty data when we start to throttle
        processes

      I ran dd if=/dev/zero bs=1M of=~/test, and watched the dirty field in atop.



      I saw dirty fluctuate pretty close to 0.5G. Never mind the "setpoint", this is even less than the dirty background threshold (0.77G)! How can this be? It is absolutely not what I would expect, based on the above documents. What am I missing?



      dirty_expire_centisecs is 30000, so I don't think that can be the cause. I even tried lowering dirty_expire_centisecs to 100, and dirty_writeback_centisecs to 10, to see if that was limiting dirty. This did not change the result.



      I initially wrote these observations as part of my post here: Why were "USB-stick stall" problems reported in 2013? Why wasn't this problem solved by the existing "No-I/O dirty throttling" code?







      linux cache sysctl atop





      share














      share












      share



      share








      edited 3 mins ago

























      asked 9 mins ago









      sourcejedi

      21.4k43395




      21.4k43395

























          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f480467%2fi-see-writeback-cache-dirty-converge-to-less-than-dirty-background-ratio-wh%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f480467%2fi-see-writeback-cache-dirty-converge-to-less-than-dirty-background-ratio-wh%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay