I use Ubuntu 20.04 with 16 GB RAM and a swappiness setting of 10. This has worked well in the past, but sometime during the last month I feel there has been a huge shift in the way memory is handled. Recently the machine has started using swap very aggressively if left unused for a while, even if there is plenty of space left in RAM. The result is that if I leave the machine overnight with a few programs running I will have to spend several minutes the next morning waiting for it to retrieve the running programs and desktop environment from swap where they are needlessly stowed even though there is plenty of free RAM. Where can this behaviour come from, and how could I modify it back to previous?
Edit: Along the lines that @rfm suggested I wrote a small script that checked memfree every 15 minutes, and also logged the output of px at the same time. Unfortunately this didn't reveal much. It was plain to see that the memory filled up after a few hours, but no running program used that much memory, instead it was the "cached" caption of meminfo that showed an increase, starting at a small part of memory but increased to the full amount of ram. Sadly I'm still no closer to knowing why this has started to happen.