Score:1

Ubuntu 20.04 has recently started to use swap very aggressively

mx flag

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.

Someone avatar
my flag
What is the output of `uname -r`
rfm avatar
mk flag
rfm
I would suspect there's some transient process, like a cron job, that fires up overnight and demands a lot of memory, forcing other stuff to swap out. Might be hard to find it, perhaps a script that checks MemFree in /proc/meminfo periodically and looks for drops. it could even log a 'px -ax' to try to catch the culprit.
Tilman avatar
cn flag
@rfm - I suggest you post that as an answer.
Markus avatar
mx flag
@Algnis: 5.4.0-90-lowlatency
Markus avatar
mx flag
@rfm: Off the top of my head I don't know any cron jobs I'm running that would do this, but your suggestion for a script is a good one, thanks.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.