A weird problem has appeared on my laptop running Ubuntu 16.04. I have 8 GiB RAM and 10 GiB swap area. It worked fine, programs were swapping fast from the SSD, the swapped memory were mostly memory leaks and forgotten mmap anyway... but then something broke it. I have no idea what, I have not noticed it immediately. But now, it swaps incredibly rarely.
The swap space is almost unoccupied, I can have 95% RAM usage and swap space is only 5% full. If RAM fills up, it rarely swaps anything out, it freezes instead, sometimes it recovers after killing a program, but way too often, I have to do a hard reset.
I have checked the swappiness property, but it is set to 60 and setting it to 100 changes nothing. I upgraded Ubuntu to version 17.04, but it didn't help.
If I run a process that takes a lot of memory and uses it actively, it appears to swap out the memory of this process (that just allocated it!), making the process freeze again soon to get back the memory shortly aferwards, in a never ending loop. Almost none of the swapped out memory remains swapped out for long, although I am pretty sure there is enough leaked memory and unused programs to swap.
Any ideas what might be wrong?