Carlos E. R. wrote:
On 2016-04-27 10:31, Bjoern Voigt wrote:
Carlos E. R. wrote: ...
Yes, I though this too and it sound logical. But even with 16 GB RAM I had the problem, that "swapoff -a" tooks much time. I will get my 16 GB RAM back soon, so I can post additional test cases.
Here is a new test case with 8 GB RAM:
mybox:~ # free -m total used free shared buff/cache available Mem: 7914 4391 253 27 3269 3335 Swap: 37383 1377 36006 mybox:~ # time swapoff -a
real 3m40.079s user 0m0.008s sys 3m0.792s mybox:~ # free -m total used free shared buff/cache available Mem: 7914 5548 57 53 2308 2152 Swap: 0 0 0 Well, you see, before swapoff you have 253MB free ram, and 1377MB in swap. It just doesn't fit! It had to eat ram from buffers and cache (which makes the computer slower). This operation takes time to do, as (I understand) affected programs have to be notified. Normally cache can be freed easily. Just destroy the cache, so that the data has to be loaded again, if needed.
Unfortunately this Swapoff operation seems to be expensive in Linux. See may mail starting with "I probably found the answer. It's a Kernel problem:"
All values are in Megabytes. I prefer "free -h", it is easier to read. Figures have the units next to them.
Swapoff takes 3:40 minutes to free 1377 MB used SWAP space. RAM is enough because 3269 MB buffer/cache space is available. But not directly free.
1377 MB in 3:40 minutes mean 6,25 MB per second. My 3 TB WD Red hard disk should have up to 147 MB per second. Of course this a theoretical value, but a SWAP partition can't be fragmented and there was not much other I/O activit I don't think disk speed is the factor here. It is possible that the system has to juggle sections in and out of swap repeatedly. Like those sliding puzzles: https://en.wikipedia.org/wiki/Sliding_puzzle#/media/File:15-puzzle.svg
It is also possible that it involves some big/slow application that has to be told. :-? Yes, see my mail starting with "I probably found the answer. It's a Kernel problem:"
Any ideas? What is a reasonable time for swapoff? I don't dare to try in my machine (I have swap 1.4G in use), but I do remember that it is quite slow. I don't remember how much.
Actually, disabling swap will make matters worse. I don't plan this. But I sometimes have discussions with Linux beginners which say: "I had a lot of memory (4 GB). I do not need swap. Swap destroys my SSD or my hard disk." It's difficult to explain them, that SWAP is good anyway. But this is another topic. Then why do you want to disable it? :-? I never said, that I want to disable swap. But I want to make swap operations faster, which doesn't seem to be possible without modifying the Kernel code itself. I know the parameters swappiness, swap priority etc. They are interesting, but do not help so much here.
I only do that operation for maintenance operations with disks. Possibly kernel devs have not optimized an operation that is seldom done. Yes, probably. Also, nearly nobody seems to use swapoff. For instance, it will probably not called during shutdown/power-off. Otherwise Linux would take several minutes for shutdown/power-off.
I wonder if other swap operation are also affected by this not optimized code. Greetings, Björn -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org