Comments on: Linux Swap Explained: Do You Need It? https://linuxiac.com/linux-swap-explained-do-you-need-it/ All things Linux & Open Source Sat, 17 May 2025 04:51:37 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Phil https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-67507 Sat, 17 May 2025 04:51:37 +0000 https://linuxiac.com/?p=164536#comment-67507 In reply to Regex.

It is nothing to worry about. this entire article it kinda pointless and makes people worry about nothing. There is basically no reason to mess with this on modern pc’s since its a waste of time to adjust.

]]>
By: Regex https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65981 Fri, 18 Apr 2025 14:18:51 +0000 https://linuxiac.com/?p=164536#comment-65981 What about ssd life cycle if i’m using swap? Ssd has a writing and reading period

]]>
By: Bob https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65966 Wed, 16 Apr 2025 22:21:10 +0000 https://linuxiac.com/?p=164536#comment-65966 In reply to Bobby Borisov.

THANKS! No wonder I can’t find it in my XFCE computer!!! 😉

]]>
By: Dilbert https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65948 Tue, 15 Apr 2025 19:45:15 +0000 https://linuxiac.com/?p=164536#comment-65948 i just use ubuntu default on this and have no reason to mess with it since everything is lightning fast on my cheap mini and even if i did mess with it i doubt i would even notice unless it created a negative impact on my system. I also never use hibernate and leave my pc on 24/7 only restarting once a week or so when i update.

]]>
By: SWAN https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65921 Mon, 14 Apr 2025 05:56:58 +0000 https://linuxiac.com/?p=164536#comment-65921 The main question for me – is Linux Kernel itself ready for this and appropriately was tested/certified for such scenarios.
Mostly it worked Ok on but with a heavy usage (inc VMs) and heavy memory load even without hitting limits it sometimes behaved weird.The most weird part and a headache was kswapd, for example:https://duckduckgo.com/?q=kswapd+high+cpu+with+no+swap&ia=webit was permanently in the TOPs of most CPU consuming tasks.It isn’t explicitly related to swap partition not used and looks like some generic problem but was a clear sign that my openSUSE(or its Kernel) wasn’t completely ready/expected to be used without a swap.Also when it looked like memory should be still enough to run new a instance of Chromium for example (that can consume ~1Gb with msTeams) sometimes it could hung for some time trying to do something – very irritating.
With Buff/Cache unclear logic – like it maybe Ok if system tries to consume all the memory to cache everything if it can be deallocated freely when additional memory is needed – that looked like not the case and again with heavy memory load I get used to clear caches (suggested for kswapd problem as well) before running the same new instance of Chromium, just to ensure that 1Gb of free memory is really here (to mitigate kswapd/hung problem above).(any additional parameters that can affect swappiness (without a swap) or caching behavior didn’t help)
It looked like Buff/Cache usage was growing anyway (or memory fragmentation) so for me it was a good idea to prophylactically restart system once a week or with each week it became considerably worse.
There are just some my observations, I don’t have that system anymore, still don’t use swap but have just more memory now and different usage, so far so good ;-).

]]>
By: Bobby Borisov https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65906 Mon, 14 Apr 2025 00:16:52 +0000 https://linuxiac.com/?p=164536#comment-65906 In reply to Bob.

That’s just the standard KDE System Monitor.

]]>
By: Bob https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65903 Sun, 13 Apr 2025 20:29:41 +0000 https://linuxiac.com/?p=164536#comment-65903 What is the System Monitor software that you used for this story’s screenshots?

]]>
By: Saku https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65888 Sat, 12 Apr 2025 18:04:00 +0000 https://linuxiac.com/?p=164536#comment-65888 Linux doesn’t move data to swap just to have more memory but also to have more file system data cached in RAM. Not having enough swap (or swappiness) means that the kernel doesn’t have the option to swap rarely used process memory from RAM to disk instead of emptying actively used data from the file system cache when more RAM space is needed. Losing that cache can hurt performance much more than having to swap process memory. The performance impact is not as simple as less swapping = more performance.

]]>
By: Jake https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65882 Sat, 12 Apr 2025 09:25:50 +0000 https://linuxiac.com/?p=164536#comment-65882 I quit using swap partitions years ago with no ill effects. Swap files are the way to go now.

]]>
By: Duncan https://linuxiac.com/linux-swap-explained-do-you-need-it/#comment-65879 Sat, 12 Apr 2025 02:18:09 +0000 https://linuxiac.com/?p=164536#comment-65879

swappiness option (a sysctl parameter ranging from 0 to 100)

Dated information. From kernel 5.8 it’s 0-200. See $KERNDIR/Documentation/admin-guide/sysctl/vm.rst , which has some discussion including explaining the tradeoff (between keeping more cached files at the expense of swapped out programs… or the reverse), and when you might want to set > 100 (with compressed-memory-backed swap such as zswap or zram, for instance) as well.
While reading that file it’s worth considering some of the other setting covered there too. Take the default write-back sizes of 5 and 10% of RAM (the dirty* settings) with today’s large RAM sizes, for instance. I’ve “only” 16 GiB RAM (of which 10% is 1.6 gigs, which takes a nice chunk of time to write-back even at ssd speeds!), so I find 1% (~160 MB) and 3% (about a 1/2 gig) work far better. With 32-gig+ I’d likely switch from ratio to bytes (so I could go under 1%) and restrict it to a similar value (in bytes), simply because writing back any more takes too long (but under 128 MB hits other limits and is likely to be inefficient).
And if you find in low-memory situations the kernel isn’t swapping enough each time so it’s having to do it too often, take a look at watermark-scale-factor. The default is 10 (=0.1% of memory), max is 1000 (=10%). I found 100 (1%, ~160 MB instead of 16 MB with 16 gig) works better here — less frequent swap-out pauses, and 160 MB at a time instead of 16 seems to be more efficient (but see next) so the system’s not stalled much longer than it is at the smaller setting.
Finally, if you’ve multiple SSDs of similar speed, consider setting up a swap partition on each, then setting equal priority= values for them in fstab. This effectively parallel-stripes swap across all of the same priority, which could be part of why that 160 MB watermark-scale-factor (across one swap each on four ssds) doesn’t seem to take much longer than the default 16 MB, while dramatically lowering the frequency of swap-pauses in swapping conditions.

]]>