Manjaro Difference between revisions of "Swap"

Difference between revisions of "Swap"

From Manjaro
m (Corrected minor typos)
m (Improved readability while translating to French)
Line 131: Line 131:
==Creating and Enabling a Static Swapfile== <!--T:41-->
==Creating and Enabling a Static Swapfile== <!--T:41-->
</translate>
</translate>
{{tip|<translate><!--T:42--> There is no reason you can't have both a swap partition and a swapfile.  This is an easy way to add more swap without repartitioning</translate>}}
{{tip|<translate><!--T:42--> There is no reason you can't have both a swap partition and a swapfile.  This is an easy way to add more swap without repartitioning.</translate>}}




Line 147: Line 147:




<translate><!--T:46--> In order to ensure that the swap is enabled at boot we can add an entry to {{ic|/etc/fstab}}.  You can add the line to ftab manually or using the command:</translate>
<translate><!--T:46--> In order to ensure that the swap is enabled at boot we can add an entry to {{ic|/etc/fstab}}.  You can add the line to fstab manually or using the command:</translate>
  sudo bash -c "echo /swapfile none swap defaults 0 0 >> /etc/fstab"
  sudo bash -c "echo /swapfile none swap defaults 0 0 >> /etc/fstab"


Line 185: Line 185:


<!--T:58-->
<!--T:58-->
First, install and enable {{ic|systemd-swap}}</translate>
First, install and enable {{ic|systemd-swap}}:</translate>
  pamac install systemd-swap
  pamac install systemd-swap
  sudo systemctl enable systemd-swap.service
  sudo systemctl enable systemd-swap.service
Line 203: Line 203:


<!--T:62-->
<!--T:62-->
In order for systemd_swap to be effective you need to remove any traditional swap devices you have.</translate>
In order for systemd-swap to be effective you need to remove any traditional swap devices you have.</translate>




Line 229: Line 229:




<translate><!--T:67--> Next reboot.  After the reboot you should see something similiar to the following when running {{ic|swapon}}</translate>
<translate><!--T:67--> Next reboot.  After the reboot, when running {{ic|swapon}} you should see something similiar to the following:</translate>
  NAME                          TYPE SIZE USED PRIO
  NAME                          TYPE SIZE USED PRIO
  /var/lib/systemd-swap/swapfc/1 file 512M  0B  -2
  /var/lib/systemd-swap/swapfc/1 file 512M  0B  -2
Line 245: Line 245:


<!--T:72-->
<!--T:72-->
To enable zswap with systemd-swap, simply alter the instructions above and set {{ic|zswap_enabled to 1}}</translate>
To enable zswap with systemd-swap, simply alter the instructions above and set Linux Kernel parameter {{ic|zswap_enabled=1}}</translate>
<translate>
<translate>
=Tuning & Performance Considerations= <!--T:73-->
=Tuning & Performance Considerations= <!--T:73-->
Line 261: Line 261:
* <translate><!--T:79--> 100 is very aggressive swapping.</translate>
* <translate><!--T:79--> 100 is very aggressive swapping.</translate>


<translate><!--T:80--> For ''most'' desktops/laptops the recommended value is 10: Theoretically, this means to only start swapping when RAM usage reaches around 90 percent.</translate>
<translate><!--T:80--> For ''most'' computers the recommended value is 10: Theoretically, this means to only start swapping when RAM usage reaches around 90 percent.</translate>


<translate><!--T:81--> {{ic|vfs_cache_pressure}} is a percentage value that controls the tendency of the kernel to *reclaim* the memory which is used for caching of directory and inode objects.  The default value is 100.</translate>  <translate><!--T:82--> Increasing this value will increase the rate in which these objects are removed from the RAM cache.  Decreasing it will allow these objects to be cached in memory longer, consuming additional RAM over time.</translate>  <translate><!--T:83--> Depending on your specific workload, increasing or decreasing this value too far can have significant negative impacts on system performance.</translate>  <translate><!--T:84--> Experimentation is needed to find the appropriate balance and the default value is reasonable.  In general, it is more common to optimize swappiness before experimenting with vfs_cache_pressure.</translate>
<translate><!--T:81--> {{ic|vfs_cache_pressure}} is a percentage value that controls the tendency of the kernel to ''reclaim'' the memory which is used for caching of directory and inode objects.  The default value is 100.</translate>  <translate><!--T:82--> Increasing this value will increase the rate in which these objects are removed from the RAM cache.  Decreasing it will allow these objects to be cached in memory longer, consuming additional RAM over time.</translate>  <translate><!--T:83--> Depending on your specific workload, increasing or decreasing this value too far can have significant negative impacts on system performance.</translate>  <translate><!--T:84--> Experimentation is needed to find the appropriate balance and the default value is reasonable.  In general, it is more common to optimize swappiness before experimenting with vfs_cache_pressure.</translate>


<translate><!--T:85--> To set these values you can use the command {{ic|sysctl}}.  For example, to set the swappiness value to 10 you could use:</translate>
<translate><!--T:85--> To set these values you can use the command {{ic|sysctl}}.  For example, to set the swappiness value to 10 you could use:</translate>
Line 279: Line 279:
* <translate><!--T:91--> The Linux kernel documentation on [<tvar|link>https://www.kernel.org/doc/Documentation/vm/zswap.txt</> zswap]</translate>
* <translate><!--T:91--> The Linux kernel documentation on [<tvar|link>https://www.kernel.org/doc/Documentation/vm/zswap.txt</> zswap]</translate>
* <translate><!--T:92--> The Linux kernel documentation on [<tvar|link>https://www.kernel.org/doc/Documentation/sysctl/vm.txt</> swappiness and vfs_cache_pressure]</translate>
* <translate><!--T:92--> The Linux kernel documentation on [<tvar|link>https://www.kernel.org/doc/Documentation/sysctl/vm.txt</> swappiness and vfs_cache_pressure]</translate>
* <translate><!--T:93--> The opensuse guide to [<tvar|link>https://doc.opensuse.org/documentation/leap/tuning/html/book.sle.tuning/cha.tuning.memory.html</> tuning memory]</translate>
* <translate><!--T:93--> The openSUSE guide to [<tvar|link>https://doc.opensuse.org/documentation/leap/tuning/html/book.sle.tuning/cha.tuning.memory.html</> tuning memory]</translate>
* <translate><!--T:94--> The [<tvar|link>https://github.com/Nefelim4ag/systemd-swap</> systemd-swap page]</translate>
* <translate><!--T:94--> The [<tvar|link>https://github.com/Nefelim4ag/systemd-swap</> systemd-swap page]</translate>
* <translate><!--T:95--> The ZFS on Linux guide on [<tvar|link>https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-use-a-zvol-as-a-swap-device</> Swap Volumes]</translate>
* <translate><!--T:95--> The ZFS on Linux guide on [<tvar|link>https://github.com/zfsonlinux/pkg-zfs/wiki/HOWTO-use-a-zvol-as-a-swap-device</> Swap Volumes]</translate>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.