Why does RHEL use swap even when vm.swappiness = 1?Why does swappiness not work?real memory usageWhat does the vm.swappiness parameter really control?Why is swap used when a lot of memory is still free?Expand the size of swap partitionWhen does the swap get emptied, after being used?Why QEMU can't use the linux memory buffers memory?Linux: When time to upgrade RAMMake or force tmpfs to swap before the file cacheExplanation for “page allocation failure” kernel messageHow shall I understand the output of free?
How did Doctor Strange see the winning outcome in Avengers: Infinity War?
Can the discrete variable be a negative number?
Would a high gravity rocky planet be guaranteed to have an atmosphere?
Energy of the particles in the particle accelerator
How can a function with a hole (removable discontinuity) equal a function with no hole?
How does the UK government determine the size of a mandate?
Gears on left are inverse to gears on right?
Large drywall patch supports
Integer addition + constant, is it a group?
Escape a backup date in a file name
What can we do to stop prior company from asking us questions?
Return the Closest Prime Number
Two monoidal structures and copowering
Is there a problem with hiding "forgot password" until it's needed?
Term for the "extreme-extension" version of a straw man fallacy?
Is expanding the research of a group into machine learning as a PhD student risky?
Opposite of a diet
A Rare Riley Riddle
How to Reset Passwords on Multiple Websites Easily?
How do scammers retract money, while you can’t?
Why not increase contact surface when reentering the atmosphere?
Class Action - which options I have?
Applicability of Single Responsibility Principle
Different result between scanning in Epson's "color negative film" mode and scanning in positive -> invert curve in post?
Why does RHEL use swap even when vm.swappiness = 1?
Why does swappiness not work?real memory usageWhat does the vm.swappiness parameter really control?Why is swap used when a lot of memory is still free?Expand the size of swap partitionWhen does the swap get emptied, after being used?Why QEMU can't use the linux memory buffers memory?Linux: When time to upgrade RAMMake or force tmpfs to swap before the file cacheExplanation for “page allocation failure” kernel messageHow shall I understand the output of free?
RHEL 7.2 memory use, per free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13383 2936 16381
we see that used swap is 2936M
so we want to decrease it to min by the following
echo 1 > /proc/sys/vm/swappiness
sysctl -w vm.swappiness=1
echo "vm.swappiness = 1" >> /etc/sysctl.conf
and after 10 min we check again , but still OS used the swap
free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13389 2930 16381
why the actions that we did not take affect immeditly?
Do we need to restart the OS, in order to get swap used to be 0 ?
example
we run vmstat
:
vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
we decrease the vm.swappiness=1
and run vmstat after 10min:
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
rhel kernel memory swap
add a comment |
RHEL 7.2 memory use, per free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13383 2936 16381
we see that used swap is 2936M
so we want to decrease it to min by the following
echo 1 > /proc/sys/vm/swappiness
sysctl -w vm.swappiness=1
echo "vm.swappiness = 1" >> /etc/sysctl.conf
and after 10 min we check again , but still OS used the swap
free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13389 2930 16381
why the actions that we did not take affect immeditly?
Do we need to restart the OS, in order to get swap used to be 0 ?
example
we run vmstat
:
vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
we decrease the vm.swappiness=1
and run vmstat after 10min:
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
rhel kernel memory swap
1
Do you know for a fact that Linux would empty the swap when you set swappiness to1
? Because what you are showing is that it does not use further swap space.
– Kusalananda♦
yesterday
1
so you have a total 384GB of RAM according to free; since that is not enough to make a system run... RH 15244 =>1.5 x RAM
is over 500gb, better go get a second disk and make the whole thing swap
– ron
13 hours ago
add a comment |
RHEL 7.2 memory use, per free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13383 2936 16381
we see that used swap is 2936M
so we want to decrease it to min by the following
echo 1 > /proc/sys/vm/swappiness
sysctl -w vm.swappiness=1
echo "vm.swappiness = 1" >> /etc/sysctl.conf
and after 10 min we check again , but still OS used the swap
free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13389 2930 16381
why the actions that we did not take affect immeditly?
Do we need to restart the OS, in order to get swap used to be 0 ?
example
we run vmstat
:
vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
we decrease the vm.swappiness=1
and run vmstat after 10min:
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
rhel kernel memory swap
RHEL 7.2 memory use, per free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13383 2936 16381
we see that used swap is 2936M
so we want to decrease it to min by the following
echo 1 > /proc/sys/vm/swappiness
sysctl -w vm.swappiness=1
echo "vm.swappiness = 1" >> /etc/sysctl.conf
and after 10 min we check again , but still OS used the swap
free -m
:
total used free shared buff/cache available
Mem: 386564 77941 57186 687 251435 306557
Swap: 13389 2930 16381
why the actions that we did not take affect immeditly?
Do we need to restart the OS, in order to get swap used to be 0 ?
example
we run vmstat
:
vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
we decrease the vm.swappiness=1
and run vmstat after 10min:
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 85740 20255872 2238248 183126400 0 0 7 162 0 0 7 1 92 0 0
rhel kernel memory swap
rhel kernel memory swap
edited 14 hours ago
GAD3R
27.5k1858114
27.5k1858114
asked yesterday
yaelyael
2,78132777
2,78132777
1
Do you know for a fact that Linux would empty the swap when you set swappiness to1
? Because what you are showing is that it does not use further swap space.
– Kusalananda♦
yesterday
1
so you have a total 384GB of RAM according to free; since that is not enough to make a system run... RH 15244 =>1.5 x RAM
is over 500gb, better go get a second disk and make the whole thing swap
– ron
13 hours ago
add a comment |
1
Do you know for a fact that Linux would empty the swap when you set swappiness to1
? Because what you are showing is that it does not use further swap space.
– Kusalananda♦
yesterday
1
so you have a total 384GB of RAM according to free; since that is not enough to make a system run... RH 15244 =>1.5 x RAM
is over 500gb, better go get a second disk and make the whole thing swap
– ron
13 hours ago
1
1
Do you know for a fact that Linux would empty the swap when you set swappiness to
1
? Because what you are showing is that it does not use further swap space.– Kusalananda♦
yesterday
Do you know for a fact that Linux would empty the swap when you set swappiness to
1
? Because what you are showing is that it does not use further swap space.– Kusalananda♦
yesterday
1
1
so you have a total 384GB of RAM according to free; since that is not enough to make a system run... RH 15244 =>
1.5 x RAM
is over 500gb, better go get a second disk and make the whole thing swap– ron
13 hours ago
so you have a total 384GB of RAM according to free; since that is not enough to make a system run... RH 15244 =>
1.5 x RAM
is over 500gb, better go get a second disk and make the whole thing swap– ron
13 hours ago
add a comment |
2 Answers
2
active
oldest
votes
As you’ve been told before (see Why does swappiness not work?), changing swappiness
only affects future decisions made by the kernel when it needs to free memory. Reducing it won’t cause the kernel to reload everything that’s been swapped out.
Your vmstat
output shows that swap isn’t being actively used, i.e. your current workloads really don’t need the pages which have been swapped out.
There’s no point in trying to micro-manage the kernel’s use of swap in the way you tend to do. Depending on your workload, decide whether you need to favour the page cache or not, adjust swappiness
accordingly, then leave the system to run.
If you really want to clear swap, disable it and re-enable it:
swapoff -a && swapon -a
add a comment |
free -m
is not a reliable source of information about swap use. Instead, please use vmstat before and after the echo commands which temporarily change swappiness.
1) swapoff -a && swapon -a && vmstat
2) do work which requires swapping
3) vmstat
Now you know how much swapping is going on before changing the swappiness. If there's no swapping going on, find other jobs which do swap.
4) use and echo command to change swappiness temporarily
5) swapoff -a && swapon -a && vmstat
6) do work which requires swapping
7) vmstat
8) compare the si and so values.
The values to watch are:
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
You may also find helpful information in the RHEL 7 Performance Tuning Guide.
Many thanks to Stephen Kitt for reminding me about swapon and swapoff.
when I run vmstat under swap I see 2224 , this is the swap that OS used?
– yael
yesterday
any I did the procedure on other machine , but vmstat about the swap , and after the procedure are the same values
– yael
yesterday
I add example of vmstat before and after , as you can see the value are the same - how it can be
– yael
yesterday
si and so are the values to look at. Since si and so have not changed, you are not swapping. As per the How To Read Vmstat Output link I provided, "The first line of the report will contain the average values since the last time the computer was rebooted." and not the immediate values.
– K7AAY
yesterday
add a comment |
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/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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508804%2fwhy-does-rhel-use-swap-even-when-vm-swappiness-1%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As you’ve been told before (see Why does swappiness not work?), changing swappiness
only affects future decisions made by the kernel when it needs to free memory. Reducing it won’t cause the kernel to reload everything that’s been swapped out.
Your vmstat
output shows that swap isn’t being actively used, i.e. your current workloads really don’t need the pages which have been swapped out.
There’s no point in trying to micro-manage the kernel’s use of swap in the way you tend to do. Depending on your workload, decide whether you need to favour the page cache or not, adjust swappiness
accordingly, then leave the system to run.
If you really want to clear swap, disable it and re-enable it:
swapoff -a && swapon -a
add a comment |
As you’ve been told before (see Why does swappiness not work?), changing swappiness
only affects future decisions made by the kernel when it needs to free memory. Reducing it won’t cause the kernel to reload everything that’s been swapped out.
Your vmstat
output shows that swap isn’t being actively used, i.e. your current workloads really don’t need the pages which have been swapped out.
There’s no point in trying to micro-manage the kernel’s use of swap in the way you tend to do. Depending on your workload, decide whether you need to favour the page cache or not, adjust swappiness
accordingly, then leave the system to run.
If you really want to clear swap, disable it and re-enable it:
swapoff -a && swapon -a
add a comment |
As you’ve been told before (see Why does swappiness not work?), changing swappiness
only affects future decisions made by the kernel when it needs to free memory. Reducing it won’t cause the kernel to reload everything that’s been swapped out.
Your vmstat
output shows that swap isn’t being actively used, i.e. your current workloads really don’t need the pages which have been swapped out.
There’s no point in trying to micro-manage the kernel’s use of swap in the way you tend to do. Depending on your workload, decide whether you need to favour the page cache or not, adjust swappiness
accordingly, then leave the system to run.
If you really want to clear swap, disable it and re-enable it:
swapoff -a && swapon -a
As you’ve been told before (see Why does swappiness not work?), changing swappiness
only affects future decisions made by the kernel when it needs to free memory. Reducing it won’t cause the kernel to reload everything that’s been swapped out.
Your vmstat
output shows that swap isn’t being actively used, i.e. your current workloads really don’t need the pages which have been swapped out.
There’s no point in trying to micro-manage the kernel’s use of swap in the way you tend to do. Depending on your workload, decide whether you need to favour the page cache or not, adjust swappiness
accordingly, then leave the system to run.
If you really want to clear swap, disable it and re-enable it:
swapoff -a && swapon -a
answered yesterday
Stephen KittStephen Kitt
178k24405482
178k24405482
add a comment |
add a comment |
free -m
is not a reliable source of information about swap use. Instead, please use vmstat before and after the echo commands which temporarily change swappiness.
1) swapoff -a && swapon -a && vmstat
2) do work which requires swapping
3) vmstat
Now you know how much swapping is going on before changing the swappiness. If there's no swapping going on, find other jobs which do swap.
4) use and echo command to change swappiness temporarily
5) swapoff -a && swapon -a && vmstat
6) do work which requires swapping
7) vmstat
8) compare the si and so values.
The values to watch are:
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
You may also find helpful information in the RHEL 7 Performance Tuning Guide.
Many thanks to Stephen Kitt for reminding me about swapon and swapoff.
when I run vmstat under swap I see 2224 , this is the swap that OS used?
– yael
yesterday
any I did the procedure on other machine , but vmstat about the swap , and after the procedure are the same values
– yael
yesterday
I add example of vmstat before and after , as you can see the value are the same - how it can be
– yael
yesterday
si and so are the values to look at. Since si and so have not changed, you are not swapping. As per the How To Read Vmstat Output link I provided, "The first line of the report will contain the average values since the last time the computer was rebooted." and not the immediate values.
– K7AAY
yesterday
add a comment |
free -m
is not a reliable source of information about swap use. Instead, please use vmstat before and after the echo commands which temporarily change swappiness.
1) swapoff -a && swapon -a && vmstat
2) do work which requires swapping
3) vmstat
Now you know how much swapping is going on before changing the swappiness. If there's no swapping going on, find other jobs which do swap.
4) use and echo command to change swappiness temporarily
5) swapoff -a && swapon -a && vmstat
6) do work which requires swapping
7) vmstat
8) compare the si and so values.
The values to watch are:
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
You may also find helpful information in the RHEL 7 Performance Tuning Guide.
Many thanks to Stephen Kitt for reminding me about swapon and swapoff.
when I run vmstat under swap I see 2224 , this is the swap that OS used?
– yael
yesterday
any I did the procedure on other machine , but vmstat about the swap , and after the procedure are the same values
– yael
yesterday
I add example of vmstat before and after , as you can see the value are the same - how it can be
– yael
yesterday
si and so are the values to look at. Since si and so have not changed, you are not swapping. As per the How To Read Vmstat Output link I provided, "The first line of the report will contain the average values since the last time the computer was rebooted." and not the immediate values.
– K7AAY
yesterday
add a comment |
free -m
is not a reliable source of information about swap use. Instead, please use vmstat before and after the echo commands which temporarily change swappiness.
1) swapoff -a && swapon -a && vmstat
2) do work which requires swapping
3) vmstat
Now you know how much swapping is going on before changing the swappiness. If there's no swapping going on, find other jobs which do swap.
4) use and echo command to change swappiness temporarily
5) swapoff -a && swapon -a && vmstat
6) do work which requires swapping
7) vmstat
8) compare the si and so values.
The values to watch are:
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
You may also find helpful information in the RHEL 7 Performance Tuning Guide.
Many thanks to Stephen Kitt for reminding me about swapon and swapoff.
free -m
is not a reliable source of information about swap use. Instead, please use vmstat before and after the echo commands which temporarily change swappiness.
1) swapoff -a && swapon -a && vmstat
2) do work which requires swapping
3) vmstat
Now you know how much swapping is going on before changing the swappiness. If there's no swapping going on, find other jobs which do swap.
4) use and echo command to change swappiness temporarily
5) swapoff -a && swapon -a && vmstat
6) do work which requires swapping
7) vmstat
8) compare the si and so values.
The values to watch are:
si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).
You may also find helpful information in the RHEL 7 Performance Tuning Guide.
Many thanks to Stephen Kitt for reminding me about swapon and swapoff.
edited yesterday
answered yesterday
K7AAYK7AAY
814926
814926
when I run vmstat under swap I see 2224 , this is the swap that OS used?
– yael
yesterday
any I did the procedure on other machine , but vmstat about the swap , and after the procedure are the same values
– yael
yesterday
I add example of vmstat before and after , as you can see the value are the same - how it can be
– yael
yesterday
si and so are the values to look at. Since si and so have not changed, you are not swapping. As per the How To Read Vmstat Output link I provided, "The first line of the report will contain the average values since the last time the computer was rebooted." and not the immediate values.
– K7AAY
yesterday
add a comment |
when I run vmstat under swap I see 2224 , this is the swap that OS used?
– yael
yesterday
any I did the procedure on other machine , but vmstat about the swap , and after the procedure are the same values
– yael
yesterday
I add example of vmstat before and after , as you can see the value are the same - how it can be
– yael
yesterday
si and so are the values to look at. Since si and so have not changed, you are not swapping. As per the How To Read Vmstat Output link I provided, "The first line of the report will contain the average values since the last time the computer was rebooted." and not the immediate values.
– K7AAY
yesterday
when I run vmstat under swap I see 2224 , this is the swap that OS used?
– yael
yesterday
when I run vmstat under swap I see 2224 , this is the swap that OS used?
– yael
yesterday
any I did the procedure on other machine , but vmstat about the swap , and after the procedure are the same values
– yael
yesterday
any I did the procedure on other machine , but vmstat about the swap , and after the procedure are the same values
– yael
yesterday
I add example of vmstat before and after , as you can see the value are the same - how it can be
– yael
yesterday
I add example of vmstat before and after , as you can see the value are the same - how it can be
– yael
yesterday
si and so are the values to look at. Since si and so have not changed, you are not swapping. As per the How To Read Vmstat Output link I provided, "The first line of the report will contain the average values since the last time the computer was rebooted." and not the immediate values.
– K7AAY
yesterday
si and so are the values to look at. Since si and so have not changed, you are not swapping. As per the How To Read Vmstat Output link I provided, "The first line of the report will contain the average values since the last time the computer was rebooted." and not the immediate values.
– K7AAY
yesterday
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508804%2fwhy-does-rhel-use-swap-even-when-vm-swappiness-1%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
-kernel, memory, rhel, swap
1
Do you know for a fact that Linux would empty the swap when you set swappiness to
1
? Because what you are showing is that it does not use further swap space.– Kusalananda♦
yesterday
1
so you have a total 384GB of RAM according to free; since that is not enough to make a system run... RH 15244 =>
1.5 x RAM
is over 500gb, better go get a second disk and make the whole thing swap– ron
13 hours ago