Swap is half full but nothing is going in or out of swap

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











up vote
0
down vote

favorite












I ran a job that exceeded the memory, and began to write into the swap. The swap is 25 GB, and the RAM is 1TB.



I have stopped the job when the swap was full until 11GB, so 50% of it was still empty.



It did not trigger any OOM kill jobs, so everything is going as normal as before it happened.



I have only 8GB swap used now (3GB is cleaned after I have stopped the job), and it is slowly decreasing. But when I check vmstat, the si and so are both 0, so there is nothing going in or out of swap? How can this be possible?



free -lm
total used free shared buff/cache available
Mem: 1031757 475637 49100 63 507019 553720
Low: 1031757 982657 49100
High: 0 0 0
Swap: 25767 8272 17495


I have a free space of 40GB in RAM, so should I expect that my running jobs will be killed by OOM not now but later on? 8GB used in swap is smaller than 40GB free space in RAM, so it looks fine, but I am not sure if still tells that OOM won't be triggered..



Couple months ago, when the OOM was triggered, it killed all my jobs and used swap was 25GB (all full) and then 10 minutes later 0GB.
However in this case, it takes a day to clean 2-3 GB from swap.
Is it bad news for my running jobs?



Do you think my running jobs are in danger of being killed, not now but later on, when free swapspace reaches 0 GB as it would trigger OOM to kill?
If that is the case, how can I prevent it from happening?



I would appreciate any help.







share|improve this question






















  • you seem to have created a duplicate account. to fix, see unix.stackexchange.com/help/merging-accounts
    – cas
    Jan 30 at 12:06







  • 2




    Are you running vmstat with a count/delay?
    – Raman Sailopal
    Jan 30 at 12:19










  • I am not sure. I am just asking for vmstat without any parameters
    – bapors
    Jan 30 at 13:21














up vote
0
down vote

favorite












I ran a job that exceeded the memory, and began to write into the swap. The swap is 25 GB, and the RAM is 1TB.



I have stopped the job when the swap was full until 11GB, so 50% of it was still empty.



It did not trigger any OOM kill jobs, so everything is going as normal as before it happened.



I have only 8GB swap used now (3GB is cleaned after I have stopped the job), and it is slowly decreasing. But when I check vmstat, the si and so are both 0, so there is nothing going in or out of swap? How can this be possible?



free -lm
total used free shared buff/cache available
Mem: 1031757 475637 49100 63 507019 553720
Low: 1031757 982657 49100
High: 0 0 0
Swap: 25767 8272 17495


I have a free space of 40GB in RAM, so should I expect that my running jobs will be killed by OOM not now but later on? 8GB used in swap is smaller than 40GB free space in RAM, so it looks fine, but I am not sure if still tells that OOM won't be triggered..



Couple months ago, when the OOM was triggered, it killed all my jobs and used swap was 25GB (all full) and then 10 minutes later 0GB.
However in this case, it takes a day to clean 2-3 GB from swap.
Is it bad news for my running jobs?



Do you think my running jobs are in danger of being killed, not now but later on, when free swapspace reaches 0 GB as it would trigger OOM to kill?
If that is the case, how can I prevent it from happening?



I would appreciate any help.







share|improve this question






















  • you seem to have created a duplicate account. to fix, see unix.stackexchange.com/help/merging-accounts
    – cas
    Jan 30 at 12:06







  • 2




    Are you running vmstat with a count/delay?
    – Raman Sailopal
    Jan 30 at 12:19










  • I am not sure. I am just asking for vmstat without any parameters
    – bapors
    Jan 30 at 13:21












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I ran a job that exceeded the memory, and began to write into the swap. The swap is 25 GB, and the RAM is 1TB.



I have stopped the job when the swap was full until 11GB, so 50% of it was still empty.



It did not trigger any OOM kill jobs, so everything is going as normal as before it happened.



I have only 8GB swap used now (3GB is cleaned after I have stopped the job), and it is slowly decreasing. But when I check vmstat, the si and so are both 0, so there is nothing going in or out of swap? How can this be possible?



free -lm
total used free shared buff/cache available
Mem: 1031757 475637 49100 63 507019 553720
Low: 1031757 982657 49100
High: 0 0 0
Swap: 25767 8272 17495


I have a free space of 40GB in RAM, so should I expect that my running jobs will be killed by OOM not now but later on? 8GB used in swap is smaller than 40GB free space in RAM, so it looks fine, but I am not sure if still tells that OOM won't be triggered..



Couple months ago, when the OOM was triggered, it killed all my jobs and used swap was 25GB (all full) and then 10 minutes later 0GB.
However in this case, it takes a day to clean 2-3 GB from swap.
Is it bad news for my running jobs?



Do you think my running jobs are in danger of being killed, not now but later on, when free swapspace reaches 0 GB as it would trigger OOM to kill?
If that is the case, how can I prevent it from happening?



I would appreciate any help.







share|improve this question














I ran a job that exceeded the memory, and began to write into the swap. The swap is 25 GB, and the RAM is 1TB.



I have stopped the job when the swap was full until 11GB, so 50% of it was still empty.



It did not trigger any OOM kill jobs, so everything is going as normal as before it happened.



I have only 8GB swap used now (3GB is cleaned after I have stopped the job), and it is slowly decreasing. But when I check vmstat, the si and so are both 0, so there is nothing going in or out of swap? How can this be possible?



free -lm
total used free shared buff/cache available
Mem: 1031757 475637 49100 63 507019 553720
Low: 1031757 982657 49100
High: 0 0 0
Swap: 25767 8272 17495


I have a free space of 40GB in RAM, so should I expect that my running jobs will be killed by OOM not now but later on? 8GB used in swap is smaller than 40GB free space in RAM, so it looks fine, but I am not sure if still tells that OOM won't be triggered..



Couple months ago, when the OOM was triggered, it killed all my jobs and used swap was 25GB (all full) and then 10 minutes later 0GB.
However in this case, it takes a day to clean 2-3 GB from swap.
Is it bad news for my running jobs?



Do you think my running jobs are in danger of being killed, not now but later on, when free swapspace reaches 0 GB as it would trigger OOM to kill?
If that is the case, how can I prevent it from happening?



I would appreciate any help.









share|improve this question













share|improve this question




share|improve this question








edited Jan 30 at 15:15









wurtel

9,18511024




9,18511024










asked Jan 30 at 11:51









bapors

1




1











  • you seem to have created a duplicate account. to fix, see unix.stackexchange.com/help/merging-accounts
    – cas
    Jan 30 at 12:06







  • 2




    Are you running vmstat with a count/delay?
    – Raman Sailopal
    Jan 30 at 12:19










  • I am not sure. I am just asking for vmstat without any parameters
    – bapors
    Jan 30 at 13:21
















  • you seem to have created a duplicate account. to fix, see unix.stackexchange.com/help/merging-accounts
    – cas
    Jan 30 at 12:06







  • 2




    Are you running vmstat with a count/delay?
    – Raman Sailopal
    Jan 30 at 12:19










  • I am not sure. I am just asking for vmstat without any parameters
    – bapors
    Jan 30 at 13:21















you seem to have created a duplicate account. to fix, see unix.stackexchange.com/help/merging-accounts
– cas
Jan 30 at 12:06





you seem to have created a duplicate account. to fix, see unix.stackexchange.com/help/merging-accounts
– cas
Jan 30 at 12:06





2




2




Are you running vmstat with a count/delay?
– Raman Sailopal
Jan 30 at 12:19




Are you running vmstat with a count/delay?
– Raman Sailopal
Jan 30 at 12:19












I am not sure. I am just asking for vmstat without any parameters
– bapors
Jan 30 at 13:21




I am not sure. I am just asking for vmstat without any parameters
– bapors
Jan 30 at 13:21










1 Answer
1






active

oldest

votes

















up vote
1
down vote













vmstat without parameters shows the average values since reboot. As the swap in / swap out is shown as blocks/second, it's not strange that those are showing 0, if you have a reasonable uptime.



Whatever is now in swap is memory that is in use, but not used since the time it was swapped out due to the overloading of the memory by your process. This is actually a good thing, as many processes have memory that is e.g. only used during startup. Having this swapped out means that you have more free RAM available for processes and buffers/cache.



The reason that in the earlier case, when you did get OOM, afterwards all swapspace was free again shortly after the event is probably because the OOM-causing process had used all the space and after it was stopped all the swapspace was free again.



The only time when you will get OOM is when there is no free swap space, and there is no RAM free (taking into account the buffers/cache, i.e. the "available" column of the free command).



For the rest you can usually trust Linux's memory management to do the right thing. Only if you have really special requirements due to the sort of load / application you're running can it be necessary to start tuning the memory management.






share|improve this answer






















  • I mean when swap reaches 0GB in use space ( so it will be all free )
    – bapors
    Jan 30 at 14:31










  • OK, I've edited your question a bit to make it a bit clearer. And edited my answer to explain the free swap in the OOM case.
    – wurtel
    Jan 30 at 15:16











  • thank you very much for your reply. However, if I got into the swap directly, wouldnt some jobs be flagged to be killed by OMM already? So that I will have a problem when the swap is all free?
    – bapors
    Jan 31 at 12:37






  • 1




    Only if there is no free memory and no free swap will the OOM killer be invoked. Jobs aren't "flagged" to be killed, the OOM killer, when started, looks for the best candidate to kill, which is usually the job that has caused the OOM condition.
    – wurtel
    Jan 31 at 13:40










  • I understand..Thank you very much for your informative replies. They helped me a lot.
    – bapors
    Feb 3 at 19:40











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: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
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%2f420651%2fswap-is-half-full-but-nothing-is-going-in-or-out-of-swap%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













vmstat without parameters shows the average values since reboot. As the swap in / swap out is shown as blocks/second, it's not strange that those are showing 0, if you have a reasonable uptime.



Whatever is now in swap is memory that is in use, but not used since the time it was swapped out due to the overloading of the memory by your process. This is actually a good thing, as many processes have memory that is e.g. only used during startup. Having this swapped out means that you have more free RAM available for processes and buffers/cache.



The reason that in the earlier case, when you did get OOM, afterwards all swapspace was free again shortly after the event is probably because the OOM-causing process had used all the space and after it was stopped all the swapspace was free again.



The only time when you will get OOM is when there is no free swap space, and there is no RAM free (taking into account the buffers/cache, i.e. the "available" column of the free command).



For the rest you can usually trust Linux's memory management to do the right thing. Only if you have really special requirements due to the sort of load / application you're running can it be necessary to start tuning the memory management.






share|improve this answer






















  • I mean when swap reaches 0GB in use space ( so it will be all free )
    – bapors
    Jan 30 at 14:31










  • OK, I've edited your question a bit to make it a bit clearer. And edited my answer to explain the free swap in the OOM case.
    – wurtel
    Jan 30 at 15:16











  • thank you very much for your reply. However, if I got into the swap directly, wouldnt some jobs be flagged to be killed by OMM already? So that I will have a problem when the swap is all free?
    – bapors
    Jan 31 at 12:37






  • 1




    Only if there is no free memory and no free swap will the OOM killer be invoked. Jobs aren't "flagged" to be killed, the OOM killer, when started, looks for the best candidate to kill, which is usually the job that has caused the OOM condition.
    – wurtel
    Jan 31 at 13:40










  • I understand..Thank you very much for your informative replies. They helped me a lot.
    – bapors
    Feb 3 at 19:40















up vote
1
down vote













vmstat without parameters shows the average values since reboot. As the swap in / swap out is shown as blocks/second, it's not strange that those are showing 0, if you have a reasonable uptime.



Whatever is now in swap is memory that is in use, but not used since the time it was swapped out due to the overloading of the memory by your process. This is actually a good thing, as many processes have memory that is e.g. only used during startup. Having this swapped out means that you have more free RAM available for processes and buffers/cache.



The reason that in the earlier case, when you did get OOM, afterwards all swapspace was free again shortly after the event is probably because the OOM-causing process had used all the space and after it was stopped all the swapspace was free again.



The only time when you will get OOM is when there is no free swap space, and there is no RAM free (taking into account the buffers/cache, i.e. the "available" column of the free command).



For the rest you can usually trust Linux's memory management to do the right thing. Only if you have really special requirements due to the sort of load / application you're running can it be necessary to start tuning the memory management.






share|improve this answer






















  • I mean when swap reaches 0GB in use space ( so it will be all free )
    – bapors
    Jan 30 at 14:31










  • OK, I've edited your question a bit to make it a bit clearer. And edited my answer to explain the free swap in the OOM case.
    – wurtel
    Jan 30 at 15:16











  • thank you very much for your reply. However, if I got into the swap directly, wouldnt some jobs be flagged to be killed by OMM already? So that I will have a problem when the swap is all free?
    – bapors
    Jan 31 at 12:37






  • 1




    Only if there is no free memory and no free swap will the OOM killer be invoked. Jobs aren't "flagged" to be killed, the OOM killer, when started, looks for the best candidate to kill, which is usually the job that has caused the OOM condition.
    – wurtel
    Jan 31 at 13:40










  • I understand..Thank you very much for your informative replies. They helped me a lot.
    – bapors
    Feb 3 at 19:40













up vote
1
down vote










up vote
1
down vote









vmstat without parameters shows the average values since reboot. As the swap in / swap out is shown as blocks/second, it's not strange that those are showing 0, if you have a reasonable uptime.



Whatever is now in swap is memory that is in use, but not used since the time it was swapped out due to the overloading of the memory by your process. This is actually a good thing, as many processes have memory that is e.g. only used during startup. Having this swapped out means that you have more free RAM available for processes and buffers/cache.



The reason that in the earlier case, when you did get OOM, afterwards all swapspace was free again shortly after the event is probably because the OOM-causing process had used all the space and after it was stopped all the swapspace was free again.



The only time when you will get OOM is when there is no free swap space, and there is no RAM free (taking into account the buffers/cache, i.e. the "available" column of the free command).



For the rest you can usually trust Linux's memory management to do the right thing. Only if you have really special requirements due to the sort of load / application you're running can it be necessary to start tuning the memory management.






share|improve this answer














vmstat without parameters shows the average values since reboot. As the swap in / swap out is shown as blocks/second, it's not strange that those are showing 0, if you have a reasonable uptime.



Whatever is now in swap is memory that is in use, but not used since the time it was swapped out due to the overloading of the memory by your process. This is actually a good thing, as many processes have memory that is e.g. only used during startup. Having this swapped out means that you have more free RAM available for processes and buffers/cache.



The reason that in the earlier case, when you did get OOM, afterwards all swapspace was free again shortly after the event is probably because the OOM-causing process had used all the space and after it was stopped all the swapspace was free again.



The only time when you will get OOM is when there is no free swap space, and there is no RAM free (taking into account the buffers/cache, i.e. the "available" column of the free command).



For the rest you can usually trust Linux's memory management to do the right thing. Only if you have really special requirements due to the sort of load / application you're running can it be necessary to start tuning the memory management.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 30 at 15:18

























answered Jan 30 at 14:27









wurtel

9,18511024




9,18511024











  • I mean when swap reaches 0GB in use space ( so it will be all free )
    – bapors
    Jan 30 at 14:31










  • OK, I've edited your question a bit to make it a bit clearer. And edited my answer to explain the free swap in the OOM case.
    – wurtel
    Jan 30 at 15:16











  • thank you very much for your reply. However, if I got into the swap directly, wouldnt some jobs be flagged to be killed by OMM already? So that I will have a problem when the swap is all free?
    – bapors
    Jan 31 at 12:37






  • 1




    Only if there is no free memory and no free swap will the OOM killer be invoked. Jobs aren't "flagged" to be killed, the OOM killer, when started, looks for the best candidate to kill, which is usually the job that has caused the OOM condition.
    – wurtel
    Jan 31 at 13:40










  • I understand..Thank you very much for your informative replies. They helped me a lot.
    – bapors
    Feb 3 at 19:40

















  • I mean when swap reaches 0GB in use space ( so it will be all free )
    – bapors
    Jan 30 at 14:31










  • OK, I've edited your question a bit to make it a bit clearer. And edited my answer to explain the free swap in the OOM case.
    – wurtel
    Jan 30 at 15:16











  • thank you very much for your reply. However, if I got into the swap directly, wouldnt some jobs be flagged to be killed by OMM already? So that I will have a problem when the swap is all free?
    – bapors
    Jan 31 at 12:37






  • 1




    Only if there is no free memory and no free swap will the OOM killer be invoked. Jobs aren't "flagged" to be killed, the OOM killer, when started, looks for the best candidate to kill, which is usually the job that has caused the OOM condition.
    – wurtel
    Jan 31 at 13:40










  • I understand..Thank you very much for your informative replies. They helped me a lot.
    – bapors
    Feb 3 at 19:40
















I mean when swap reaches 0GB in use space ( so it will be all free )
– bapors
Jan 30 at 14:31




I mean when swap reaches 0GB in use space ( so it will be all free )
– bapors
Jan 30 at 14:31












OK, I've edited your question a bit to make it a bit clearer. And edited my answer to explain the free swap in the OOM case.
– wurtel
Jan 30 at 15:16





OK, I've edited your question a bit to make it a bit clearer. And edited my answer to explain the free swap in the OOM case.
– wurtel
Jan 30 at 15:16













thank you very much for your reply. However, if I got into the swap directly, wouldnt some jobs be flagged to be killed by OMM already? So that I will have a problem when the swap is all free?
– bapors
Jan 31 at 12:37




thank you very much for your reply. However, if I got into the swap directly, wouldnt some jobs be flagged to be killed by OMM already? So that I will have a problem when the swap is all free?
– bapors
Jan 31 at 12:37




1




1




Only if there is no free memory and no free swap will the OOM killer be invoked. Jobs aren't "flagged" to be killed, the OOM killer, when started, looks for the best candidate to kill, which is usually the job that has caused the OOM condition.
– wurtel
Jan 31 at 13:40




Only if there is no free memory and no free swap will the OOM killer be invoked. Jobs aren't "flagged" to be killed, the OOM killer, when started, looks for the best candidate to kill, which is usually the job that has caused the OOM condition.
– wurtel
Jan 31 at 13:40












I understand..Thank you very much for your informative replies. They helped me a lot.
– bapors
Feb 3 at 19:40





I understand..Thank you very much for your informative replies. They helped me a lot.
– bapors
Feb 3 at 19:40













 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420651%2fswap-is-half-full-but-nothing-is-going-in-or-out-of-swap%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?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?