
# free -m total used free shared buff/cache available Mem: 7962 2212 498 533 5251 4942 Swap: 10719 1732 8986
The above is from my workstation. It's running KDE, Chrome, KTorrent, and not much else. My understanding of the above is that most RAM is being used for cache and it's quite likely that this achieves the goal of reducing the number of storage accesses.
The problem is that I don't want to reduce the number of storage accesses, I want to improve the performance of interactive tasks. Ktorrent is configured to only upload 60KB/s so a lack of caching of the torrents shouldn't prevent it from uploading at the maximum speed I permit. When large interactive programs like Chrome and Kmail get paged out it causes annoying delays when I want to perform what should be quick tasks like replying to a single message or viewing a single web page.
Any suggestions as to how to optimise for this use case? I already have swap on one of the fastest SSDs I own and don't feel like buying NVMe for this purpose or buying a system with more RAM, so software changes are required.
Have you done the analysis to confirm your suspicions? Iostat while switching to Chrome etc? I believe Linux will prematurely swap stuff out without invalidating the actual memory pages, so that when it actually needs the memory it can just use it without first having to wait for it to be written to disk, and conversely if the original owner of the page needs the memory back it's still there. While a page is in this stage - ready to be used for something else but still containing a valid copy of the original page - I don't know how it shows in the output of free. It is simultaneously "paged out", "free", and "in use", so I think maybe some further analysis is required to see exactly what is going on. Based on the above output of free, you could try leaving Chrome alone for a while, then when you want to use it, turn swap off then on again, then see if Chrome is fast to switch to. If not, then the delay might be coming from elsewhere. If you just want to tinker, start with lowering the "swappiness" control. James