how disable use swap partition by processes , only if its really need
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
My embedded system has 2 GB RAM and 100 MB swap partition.
I recognize, after continues monitoring that average memory usage of RAM is ~50 %.
For some reason system start use SWAP memory and use almost 40 % of it (40 MB).
I want prevent such thing because my device flash has a big problem with number of writes and I need it for ~10 years of use.
After run these set of commands I get to list of processes that use SWAP :
for file in /proc/*/status ; do awk '/VmSwap|Name/printf $2 " " $3END print ""' $file; done | sort -k 2 -n -r | lessâÂÂ
My system file /etc/sysctl.conf
confiured with parameter : vm.swappiness=1
, so according articles I read it should use SWAP only if it really need.
(I investigated the results with vm.sappiness=0
, but didn't have results yet.)
I know that there is a way to prevent from specific processes use swap, but what is a correct one?
linux swap process-management
add a comment |Â
up vote
1
down vote
favorite
My embedded system has 2 GB RAM and 100 MB swap partition.
I recognize, after continues monitoring that average memory usage of RAM is ~50 %.
For some reason system start use SWAP memory and use almost 40 % of it (40 MB).
I want prevent such thing because my device flash has a big problem with number of writes and I need it for ~10 years of use.
After run these set of commands I get to list of processes that use SWAP :
for file in /proc/*/status ; do awk '/VmSwap|Name/printf $2 " " $3END print ""' $file; done | sort -k 2 -n -r | lessâÂÂ
My system file /etc/sysctl.conf
confiured with parameter : vm.swappiness=1
, so according articles I read it should use SWAP only if it really need.
(I investigated the results with vm.sappiness=0
, but didn't have results yet.)
I know that there is a way to prevent from specific processes use swap, but what is a correct one?
linux swap process-management
This doesn't answer your question, but with that setup, do you need the swap in the first place? 100 MB isn't that much on a 2 GB machine, so you could probably do without it, and avoid this issue too. Also, the amount of swap in use at one time doesn't tell how much writes go to the swap: some rarely-if-ever used data might end up in swap the first the memory is full, and if it's never modified, there are no further writes.
â ilkkachu
Nov 6 '17 at 14:56
This sounds like a job for thenice
family... ionice nice renice
â RubberStamp
Nov 6 '17 at 15:03
You may also want to decrease verbosity level of logs in rsyslog configuration.
â Jaroslav Kucera
Nov 6 '17 at 15:36
my system is embedded base very shrink Debian 8 based system , that has problem with number of writes/read per-block on his flash drive, but it run an application that use pretty more resources. This is a reason why we declare swap partition if system get to critical point it will use swap partition.
â Sergey Meerovich
Nov 7 '17 at 12:15
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
My embedded system has 2 GB RAM and 100 MB swap partition.
I recognize, after continues monitoring that average memory usage of RAM is ~50 %.
For some reason system start use SWAP memory and use almost 40 % of it (40 MB).
I want prevent such thing because my device flash has a big problem with number of writes and I need it for ~10 years of use.
After run these set of commands I get to list of processes that use SWAP :
for file in /proc/*/status ; do awk '/VmSwap|Name/printf $2 " " $3END print ""' $file; done | sort -k 2 -n -r | lessâÂÂ
My system file /etc/sysctl.conf
confiured with parameter : vm.swappiness=1
, so according articles I read it should use SWAP only if it really need.
(I investigated the results with vm.sappiness=0
, but didn't have results yet.)
I know that there is a way to prevent from specific processes use swap, but what is a correct one?
linux swap process-management
My embedded system has 2 GB RAM and 100 MB swap partition.
I recognize, after continues monitoring that average memory usage of RAM is ~50 %.
For some reason system start use SWAP memory and use almost 40 % of it (40 MB).
I want prevent such thing because my device flash has a big problem with number of writes and I need it for ~10 years of use.
After run these set of commands I get to list of processes that use SWAP :
for file in /proc/*/status ; do awk '/VmSwap|Name/printf $2 " " $3END print ""' $file; done | sort -k 2 -n -r | lessâÂÂ
My system file /etc/sysctl.conf
confiured with parameter : vm.swappiness=1
, so according articles I read it should use SWAP only if it really need.
(I investigated the results with vm.sappiness=0
, but didn't have results yet.)
I know that there is a way to prevent from specific processes use swap, but what is a correct one?
linux swap process-management
edited Nov 6 '17 at 14:52
ilkkachu
50.5k677138
50.5k677138
asked Nov 6 '17 at 14:31
Sergey Meerovich
263
263
This doesn't answer your question, but with that setup, do you need the swap in the first place? 100 MB isn't that much on a 2 GB machine, so you could probably do without it, and avoid this issue too. Also, the amount of swap in use at one time doesn't tell how much writes go to the swap: some rarely-if-ever used data might end up in swap the first the memory is full, and if it's never modified, there are no further writes.
â ilkkachu
Nov 6 '17 at 14:56
This sounds like a job for thenice
family... ionice nice renice
â RubberStamp
Nov 6 '17 at 15:03
You may also want to decrease verbosity level of logs in rsyslog configuration.
â Jaroslav Kucera
Nov 6 '17 at 15:36
my system is embedded base very shrink Debian 8 based system , that has problem with number of writes/read per-block on his flash drive, but it run an application that use pretty more resources. This is a reason why we declare swap partition if system get to critical point it will use swap partition.
â Sergey Meerovich
Nov 7 '17 at 12:15
add a comment |Â
This doesn't answer your question, but with that setup, do you need the swap in the first place? 100 MB isn't that much on a 2 GB machine, so you could probably do without it, and avoid this issue too. Also, the amount of swap in use at one time doesn't tell how much writes go to the swap: some rarely-if-ever used data might end up in swap the first the memory is full, and if it's never modified, there are no further writes.
â ilkkachu
Nov 6 '17 at 14:56
This sounds like a job for thenice
family... ionice nice renice
â RubberStamp
Nov 6 '17 at 15:03
You may also want to decrease verbosity level of logs in rsyslog configuration.
â Jaroslav Kucera
Nov 6 '17 at 15:36
my system is embedded base very shrink Debian 8 based system , that has problem with number of writes/read per-block on his flash drive, but it run an application that use pretty more resources. This is a reason why we declare swap partition if system get to critical point it will use swap partition.
â Sergey Meerovich
Nov 7 '17 at 12:15
This doesn't answer your question, but with that setup, do you need the swap in the first place? 100 MB isn't that much on a 2 GB machine, so you could probably do without it, and avoid this issue too. Also, the amount of swap in use at one time doesn't tell how much writes go to the swap: some rarely-if-ever used data might end up in swap the first the memory is full, and if it's never modified, there are no further writes.
â ilkkachu
Nov 6 '17 at 14:56
This doesn't answer your question, but with that setup, do you need the swap in the first place? 100 MB isn't that much on a 2 GB machine, so you could probably do without it, and avoid this issue too. Also, the amount of swap in use at one time doesn't tell how much writes go to the swap: some rarely-if-ever used data might end up in swap the first the memory is full, and if it's never modified, there are no further writes.
â ilkkachu
Nov 6 '17 at 14:56
This sounds like a job for the
nice
family... ionice nice reniceâ RubberStamp
Nov 6 '17 at 15:03
This sounds like a job for the
nice
family... ionice nice reniceâ RubberStamp
Nov 6 '17 at 15:03
You may also want to decrease verbosity level of logs in rsyslog configuration.
â Jaroslav Kucera
Nov 6 '17 at 15:36
You may also want to decrease verbosity level of logs in rsyslog configuration.
â Jaroslav Kucera
Nov 6 '17 at 15:36
my system is embedded base very shrink Debian 8 based system , that has problem with number of writes/read per-block on his flash drive, but it run an application that use pretty more resources. This is a reason why we declare swap partition if system get to critical point it will use swap partition.
â Sergey Meerovich
Nov 7 '17 at 12:15
my system is embedded base very shrink Debian 8 based system , that has problem with number of writes/read per-block on his flash drive, but it run an application that use pretty more resources. This is a reason why we declare swap partition if system get to critical point it will use swap partition.
â Sergey Meerovich
Nov 7 '17 at 12:15
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
You can set swappiness per process with cgroups
echo 0 > /sys/fs/cgroup/<your custom group>/memory.swappiness
Anyway my advice is to use zram for compressed swapping in ram.
Just to add, this can also be achieved with the libcgroup and the cgset command.
â Raman Sailopal
Nov 6 '17 at 15:28
add a comment |Â
up vote
0
down vote
I test on two systems , where I detect previously use of 40% of SWAP option of :
vm.swappiness=0
This option really helped . I didn't see any use of swap for last 4 days
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
You can set swappiness per process with cgroups
echo 0 > /sys/fs/cgroup/<your custom group>/memory.swappiness
Anyway my advice is to use zram for compressed swapping in ram.
Just to add, this can also be achieved with the libcgroup and the cgset command.
â Raman Sailopal
Nov 6 '17 at 15:28
add a comment |Â
up vote
4
down vote
You can set swappiness per process with cgroups
echo 0 > /sys/fs/cgroup/<your custom group>/memory.swappiness
Anyway my advice is to use zram for compressed swapping in ram.
Just to add, this can also be achieved with the libcgroup and the cgset command.
â Raman Sailopal
Nov 6 '17 at 15:28
add a comment |Â
up vote
4
down vote
up vote
4
down vote
You can set swappiness per process with cgroups
echo 0 > /sys/fs/cgroup/<your custom group>/memory.swappiness
Anyway my advice is to use zram for compressed swapping in ram.
You can set swappiness per process with cgroups
echo 0 > /sys/fs/cgroup/<your custom group>/memory.swappiness
Anyway my advice is to use zram for compressed swapping in ram.
edited Nov 6 '17 at 15:20
answered Nov 6 '17 at 15:13
Ipor Sircer
8,8921920
8,8921920
Just to add, this can also be achieved with the libcgroup and the cgset command.
â Raman Sailopal
Nov 6 '17 at 15:28
add a comment |Â
Just to add, this can also be achieved with the libcgroup and the cgset command.
â Raman Sailopal
Nov 6 '17 at 15:28
Just to add, this can also be achieved with the libcgroup and the cgset command.
â Raman Sailopal
Nov 6 '17 at 15:28
Just to add, this can also be achieved with the libcgroup and the cgset command.
â Raman Sailopal
Nov 6 '17 at 15:28
add a comment |Â
up vote
0
down vote
I test on two systems , where I detect previously use of 40% of SWAP option of :
vm.swappiness=0
This option really helped . I didn't see any use of swap for last 4 days
add a comment |Â
up vote
0
down vote
I test on two systems , where I detect previously use of 40% of SWAP option of :
vm.swappiness=0
This option really helped . I didn't see any use of swap for last 4 days
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I test on two systems , where I detect previously use of 40% of SWAP option of :
vm.swappiness=0
This option really helped . I didn't see any use of swap for last 4 days
I test on two systems , where I detect previously use of 40% of SWAP option of :
vm.swappiness=0
This option really helped . I didn't see any use of swap for last 4 days
answered Nov 10 '17 at 8:11
Sergey Meerovich
263
263
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f402841%2fhow-disable-use-swap-partition-by-processes-only-if-its-really-need%23new-answer', 'question_page');
);
Post as a guest
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
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
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
This doesn't answer your question, but with that setup, do you need the swap in the first place? 100 MB isn't that much on a 2 GB machine, so you could probably do without it, and avoid this issue too. Also, the amount of swap in use at one time doesn't tell how much writes go to the swap: some rarely-if-ever used data might end up in swap the first the memory is full, and if it's never modified, there are no further writes.
â ilkkachu
Nov 6 '17 at 14:56
This sounds like a job for the
nice
family... ionice nice reniceâ RubberStamp
Nov 6 '17 at 15:03
You may also want to decrease verbosity level of logs in rsyslog configuration.
â Jaroslav Kucera
Nov 6 '17 at 15:36
my system is embedded base very shrink Debian 8 based system , that has problem with number of writes/read per-block on his flash drive, but it run an application that use pretty more resources. This is a reason why we declare swap partition if system get to critical point it will use swap partition.
â Sergey Meerovich
Nov 7 '17 at 12:15