Why does swappiness not work?Swap partition is used only when RAM usage is to the fullWhy is swappiness set...

Why did the range based for loop specification change in C++17

Test if two foods are the same

How can I replicate this effect of the Infinity Gauntlet using official material?

SQL server backup message

How do you translate "Don't Fear the Reaper" into Latin?

"Dear Stack Exchange, I am very disappointed in you" - How to construct a strong opening line in a letter?

How to respond when insulted by a grad student in a different department?

What are the different ways one can refer to the home in everyday French

Non-Legendary Planeswalkers

Little Endian Number to String Conversion

What good is the paladin's Divine Sense?

Delete line if next line is the same

Why is lying to Congress a crime?

Modern warfare theory in a medieval setting

What causes standard door hinges to close up to a certain amount automatically?

Is consistent disregard for students' time "normal" in undergraduate research?

Print the sequence

Why is CMYK & PNG not possible?

First aid scissors confiscated by Dubai airport security

What is the meaning of "shop-wise" in "… and talk turned shop-wise"?

Self organizing bonuses?

Can you decide not to sneak into a room after seeing your roll?

bash - sum numbers in a variable

Is Having my Players Control Two Parties a Good Idea?



Why does swappiness not work?


Swap partition is used only when RAM usage is to the fullWhy is swappiness set to 60 by default?How can I get the amount of available memory portably across distributions?Why does RHEL use swap even when vm.swappiness = 1?Meaning of “available” field in “free -m” commandHigh swapiness on VM hostreal memory usageWhat do top's %MEM and VSZ mean?Expand the size of swap partitionWhy QEMU can't use the linux memory buffers memory?Is vm.swappiness dynamic property in linuxHow shall I understand the output of free?Why “Sum of RES” not equal to “Mem Used + Swap Used” (Ubuntu 18.04)?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}








2

















We have a RHEL 7 machine, with only 2G of available RAM:



free -g
total used free shared buff/cache available
Mem: 31 28 0 0 1 2
Swap: 15 9 5


so we decided to increase the swappiness to the maximum with vm.swappiness = 100 in /etc/sysctl.conf instead of 10, and used sysctl -p to apply the setting.



After some time we checked the status again:



 free -g
total used free shared buff/cache available
Mem: 31 28 0 0 2 2
Swap: 15 9 5


as we can see despite the new swappiness setting, we see from free -g that the available RAM stays at 2G. Why? What is wrong here?



We expected to see 15G of used swap.



We also checked:



cat /proc/sys/vm/swappiness
100


so everything should work according to the new settings BUT free shows the same situation. What is going here?










share|improve this question



































    2

















    We have a RHEL 7 machine, with only 2G of available RAM:



    free -g
    total used free shared buff/cache available
    Mem: 31 28 0 0 1 2
    Swap: 15 9 5


    so we decided to increase the swappiness to the maximum with vm.swappiness = 100 in /etc/sysctl.conf instead of 10, and used sysctl -p to apply the setting.



    After some time we checked the status again:



     free -g
    total used free shared buff/cache available
    Mem: 31 28 0 0 2 2
    Swap: 15 9 5


    as we can see despite the new swappiness setting, we see from free -g that the available RAM stays at 2G. Why? What is wrong here?



    We expected to see 15G of used swap.



    We also checked:



    cat /proc/sys/vm/swappiness
    100


    so everything should work according to the new settings BUT free shows the same situation. What is going here?










    share|improve this question































      2












      2








      2








      We have a RHEL 7 machine, with only 2G of available RAM:



      free -g
      total used free shared buff/cache available
      Mem: 31 28 0 0 1 2
      Swap: 15 9 5


      so we decided to increase the swappiness to the maximum with vm.swappiness = 100 in /etc/sysctl.conf instead of 10, and used sysctl -p to apply the setting.



      After some time we checked the status again:



       free -g
      total used free shared buff/cache available
      Mem: 31 28 0 0 2 2
      Swap: 15 9 5


      as we can see despite the new swappiness setting, we see from free -g that the available RAM stays at 2G. Why? What is wrong here?



      We expected to see 15G of used swap.



      We also checked:



      cat /proc/sys/vm/swappiness
      100


      so everything should work according to the new settings BUT free shows the same situation. What is going here?










      share|improve this question
















      We have a RHEL 7 machine, with only 2G of available RAM:



      free -g
      total used free shared buff/cache available
      Mem: 31 28 0 0 1 2
      Swap: 15 9 5


      so we decided to increase the swappiness to the maximum with vm.swappiness = 100 in /etc/sysctl.conf instead of 10, and used sysctl -p to apply the setting.



      After some time we checked the status again:



       free -g
      total used free shared buff/cache available
      Mem: 31 28 0 0 2 2
      Swap: 15 9 5


      as we can see despite the new swappiness setting, we see from free -g that the available RAM stays at 2G. Why? What is wrong here?



      We expected to see 15G of used swap.



      We also checked:



      cat /proc/sys/vm/swappiness
      100


      so everything should work according to the new settings BUT free shows the same situation. What is going here?







      linux rhel memory swap free






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question



      share|improve this question








      edited Jan 9 at 13:32









      Stephen Kitt

      207k27 gold badges490 silver badges556 bronze badges




      207k27 gold badges490 silver badges556 bronze badges










      asked Jan 9 at 11:00









      yaelyael

      3,1488 gold badges46 silver badges100 bronze badges




      3,1488 gold badges46 silver badges100 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          5


















          The swappiness setting is working as intended. Increasing swappiness doesn’t cause the system to prefer swap to anything else; increasing swappiness affects the balance between the page cache and swap. When the kernel needs to make physical memory available, it can discard generally use one of two strategies: it can discard pages from the page cache (since their content is on disk), or it can move pages to swap; swappiness determines how much it favours one strategy over another. Setting swappiness to 0 (the minimum) means the kernel will avoid swapping until it hits various high water marks, and evict pages from the page cache instead; setting it to 100 (the maximum) means the kernel will consider swapping and evicting the page cache equally.



          You’ll only see your new setting make a difference when the kernel needs more memory: you’ll see the amount of swap used increase before the amount of memory used in the cache decreases.



          You can’t use swappiness to get the kernel to keep more memory available. Physical memory is always best used rather than left free, so the kernel has no incentive to pre-emptively free physical memory (increasing available memory).



          See the RHEL 7 performance tuning guide for more information.






          share|improve this answer





























          • Stephen, you mention "setting swappiness to 100 means the kernel will always prefer swapping over discarding pages from the page cache". On the other hand Thomas Nyman's answer states setting swappiness to 100 should cause the swap and page cache priorities to be equal. Are you able to comment? Thanks

            – iruvar
            Mar 27 at 11:59













          • @iruvar thanks, my explanation was indeed incorrect. In practice the effect tends to end up being that the kernel prefers swapping, presumably because of the way it takes previous scanning results into account (I haven’t thought about it enough to say for sure), but the base priorities are indeed equal when swappiness is set to 100.

            – Stephen Kitt
            Mar 27 at 14:37













          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',
          autoActivateHeartbeat: false,
          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/4.0/"u003ecc by-sa 4.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%2f493436%2fwhy-does-swappiness-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown


























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5


















          The swappiness setting is working as intended. Increasing swappiness doesn’t cause the system to prefer swap to anything else; increasing swappiness affects the balance between the page cache and swap. When the kernel needs to make physical memory available, it can discard generally use one of two strategies: it can discard pages from the page cache (since their content is on disk), or it can move pages to swap; swappiness determines how much it favours one strategy over another. Setting swappiness to 0 (the minimum) means the kernel will avoid swapping until it hits various high water marks, and evict pages from the page cache instead; setting it to 100 (the maximum) means the kernel will consider swapping and evicting the page cache equally.



          You’ll only see your new setting make a difference when the kernel needs more memory: you’ll see the amount of swap used increase before the amount of memory used in the cache decreases.



          You can’t use swappiness to get the kernel to keep more memory available. Physical memory is always best used rather than left free, so the kernel has no incentive to pre-emptively free physical memory (increasing available memory).



          See the RHEL 7 performance tuning guide for more information.






          share|improve this answer





























          • Stephen, you mention "setting swappiness to 100 means the kernel will always prefer swapping over discarding pages from the page cache". On the other hand Thomas Nyman's answer states setting swappiness to 100 should cause the swap and page cache priorities to be equal. Are you able to comment? Thanks

            – iruvar
            Mar 27 at 11:59













          • @iruvar thanks, my explanation was indeed incorrect. In practice the effect tends to end up being that the kernel prefers swapping, presumably because of the way it takes previous scanning results into account (I haven’t thought about it enough to say for sure), but the base priorities are indeed equal when swappiness is set to 100.

            – Stephen Kitt
            Mar 27 at 14:37
















          5


















          The swappiness setting is working as intended. Increasing swappiness doesn’t cause the system to prefer swap to anything else; increasing swappiness affects the balance between the page cache and swap. When the kernel needs to make physical memory available, it can discard generally use one of two strategies: it can discard pages from the page cache (since their content is on disk), or it can move pages to swap; swappiness determines how much it favours one strategy over another. Setting swappiness to 0 (the minimum) means the kernel will avoid swapping until it hits various high water marks, and evict pages from the page cache instead; setting it to 100 (the maximum) means the kernel will consider swapping and evicting the page cache equally.



          You’ll only see your new setting make a difference when the kernel needs more memory: you’ll see the amount of swap used increase before the amount of memory used in the cache decreases.



          You can’t use swappiness to get the kernel to keep more memory available. Physical memory is always best used rather than left free, so the kernel has no incentive to pre-emptively free physical memory (increasing available memory).



          See the RHEL 7 performance tuning guide for more information.






          share|improve this answer





























          • Stephen, you mention "setting swappiness to 100 means the kernel will always prefer swapping over discarding pages from the page cache". On the other hand Thomas Nyman's answer states setting swappiness to 100 should cause the swap and page cache priorities to be equal. Are you able to comment? Thanks

            – iruvar
            Mar 27 at 11:59













          • @iruvar thanks, my explanation was indeed incorrect. In practice the effect tends to end up being that the kernel prefers swapping, presumably because of the way it takes previous scanning results into account (I haven’t thought about it enough to say for sure), but the base priorities are indeed equal when swappiness is set to 100.

            – Stephen Kitt
            Mar 27 at 14:37














          5














          5










          5









          The swappiness setting is working as intended. Increasing swappiness doesn’t cause the system to prefer swap to anything else; increasing swappiness affects the balance between the page cache and swap. When the kernel needs to make physical memory available, it can discard generally use one of two strategies: it can discard pages from the page cache (since their content is on disk), or it can move pages to swap; swappiness determines how much it favours one strategy over another. Setting swappiness to 0 (the minimum) means the kernel will avoid swapping until it hits various high water marks, and evict pages from the page cache instead; setting it to 100 (the maximum) means the kernel will consider swapping and evicting the page cache equally.



          You’ll only see your new setting make a difference when the kernel needs more memory: you’ll see the amount of swap used increase before the amount of memory used in the cache decreases.



          You can’t use swappiness to get the kernel to keep more memory available. Physical memory is always best used rather than left free, so the kernel has no incentive to pre-emptively free physical memory (increasing available memory).



          See the RHEL 7 performance tuning guide for more information.






          share|improve this answer
















          The swappiness setting is working as intended. Increasing swappiness doesn’t cause the system to prefer swap to anything else; increasing swappiness affects the balance between the page cache and swap. When the kernel needs to make physical memory available, it can discard generally use one of two strategies: it can discard pages from the page cache (since their content is on disk), or it can move pages to swap; swappiness determines how much it favours one strategy over another. Setting swappiness to 0 (the minimum) means the kernel will avoid swapping until it hits various high water marks, and evict pages from the page cache instead; setting it to 100 (the maximum) means the kernel will consider swapping and evicting the page cache equally.



          You’ll only see your new setting make a difference when the kernel needs more memory: you’ll see the amount of swap used increase before the amount of memory used in the cache decreases.



          You can’t use swappiness to get the kernel to keep more memory available. Physical memory is always best used rather than left free, so the kernel has no incentive to pre-emptively free physical memory (increasing available memory).



          See the RHEL 7 performance tuning guide for more information.







          share|improve this answer















          share|improve this answer




          share|improve this answer



          share|improve this answer








          edited Mar 27 at 14:35

























          answered Jan 9 at 13:37









          Stephen KittStephen Kitt

          207k27 gold badges490 silver badges556 bronze badges




          207k27 gold badges490 silver badges556 bronze badges
















          • Stephen, you mention "setting swappiness to 100 means the kernel will always prefer swapping over discarding pages from the page cache". On the other hand Thomas Nyman's answer states setting swappiness to 100 should cause the swap and page cache priorities to be equal. Are you able to comment? Thanks

            – iruvar
            Mar 27 at 11:59













          • @iruvar thanks, my explanation was indeed incorrect. In practice the effect tends to end up being that the kernel prefers swapping, presumably because of the way it takes previous scanning results into account (I haven’t thought about it enough to say for sure), but the base priorities are indeed equal when swappiness is set to 100.

            – Stephen Kitt
            Mar 27 at 14:37



















          • Stephen, you mention "setting swappiness to 100 means the kernel will always prefer swapping over discarding pages from the page cache". On the other hand Thomas Nyman's answer states setting swappiness to 100 should cause the swap and page cache priorities to be equal. Are you able to comment? Thanks

            – iruvar
            Mar 27 at 11:59













          • @iruvar thanks, my explanation was indeed incorrect. In practice the effect tends to end up being that the kernel prefers swapping, presumably because of the way it takes previous scanning results into account (I haven’t thought about it enough to say for sure), but the base priorities are indeed equal when swappiness is set to 100.

            – Stephen Kitt
            Mar 27 at 14:37

















          Stephen, you mention "setting swappiness to 100 means the kernel will always prefer swapping over discarding pages from the page cache". On the other hand Thomas Nyman's answer states setting swappiness to 100 should cause the swap and page cache priorities to be equal. Are you able to comment? Thanks

          – iruvar
          Mar 27 at 11:59







          Stephen, you mention "setting swappiness to 100 means the kernel will always prefer swapping over discarding pages from the page cache". On the other hand Thomas Nyman's answer states setting swappiness to 100 should cause the swap and page cache priorities to be equal. Are you able to comment? Thanks

          – iruvar
          Mar 27 at 11:59















          @iruvar thanks, my explanation was indeed incorrect. In practice the effect tends to end up being that the kernel prefers swapping, presumably because of the way it takes previous scanning results into account (I haven’t thought about it enough to say for sure), but the base priorities are indeed equal when swappiness is set to 100.

          – Stephen Kitt
          Mar 27 at 14:37





          @iruvar thanks, my explanation was indeed incorrect. In practice the effect tends to end up being that the kernel prefers swapping, presumably because of the way it takes previous scanning results into account (I haven’t thought about it enough to say for sure), but the base priorities are indeed equal when swappiness is set to 100.

          – Stephen Kitt
          Mar 27 at 14:37



















          draft saved

          draft discarded



















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493436%2fwhy-does-swappiness-not-work%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown









          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...