You are not logged in.

#1 2020-01-09 13:21:59

SandaruLJ
Member
From: Sri Lanka
Registered: 2019-10-12
Posts: 8

[Solved] Copying or moving files causes unnecessary swapping

I've been using Arch for a while now and this always bugged me. To my understanding this is because of the page/buffer cache building up when doing file operations, which is good for performance. But it keeps building to the point at which the system has to swap out applications to make way for the page cache? And when the system is swapping, it keeps swapping in and out constantly until the file operation is done, making the system less responsive.

I've seen this happen in Arch, PopOS and Elementary OS so far. So I thought this was normal for Linux. But recently I installed Linux Mint and I don't see this happening in that distro. During file operations, page cache builds up up to a point where the system has 80-120mb memory free and stops increasing any further. There is no swapping activity whatsoever when copying or moving files. The system is as responsive as ever and the files are copied/moved faster than on Arch.

So these are my questions:
1. Why does Arch (and many other distros) let the page cache build up so much that the system has to resort to swapping?
2. Why does, the same distros mentioned above, keeps swapping data in and out throughout the entire period of copying/moving files?
3. Why is this not happening in Linux Mint? Does Mint have any special settings to prevent this?
4. How do I make Arch behave like Mint (when doing file operations)?

Last edited by SandaruLJ (2020-01-11 03:27:47)

Offline

#2 2020-01-09 15:03:22

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: [Solved] Copying or moving files causes unnecessary swapping

if you were to do..

cat /proc/sys/vm/swappiness

On Linux-Mint vs Arch is there a difference?

My uninformed (as I don't have Mint to test) guess is that Mint is set to be more swapish.

FWIW my system (vanilla kernel) is 60.

Edit: Oh Look! It's in the Wiki!
https://wiki.archlinux.org/index.php/Swap#Swappiness

Last edited by Zod (2020-01-09 15:19:04)

Offline

#3 2020-01-09 15:32:18

SandaruLJ
Member
From: Sri Lanka
Registered: 2019-10-12
Posts: 8

Re: [Solved] Copying or moving files causes unnecessary swapping

Zod wrote:

On Linux-Mint vs Arch is there a difference?

No. Swappiness is set to 60 in both. I've tried setting it to 10 and even 0 on Arch, but it doesn't change the behaviour at all.
BTW, do you experience this behaviour as well? This is normal right?

Offline

#4 2020-01-09 15:38:49

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: [Solved] Copying or moving files causes unnecessary swapping

SandaruLJ wrote:

No. Swappiness is set to 60 in both. I've tried setting it to 10 and even 0 on Arch, but it doesn't change the behaviour at all.
BTW, do you experience this behaviour as well? This is normal right?

Nope, can't say as this has ever caught my eye. Maybe a difference in the amount of stuff I move around or perhaps hardware, eg faster drive or whatnot.

Offline

#5 2020-01-09 16:19:09

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,104

Re: [Solved] Copying or moving files causes unnecessary swapping

Which kernels, which IO schedulers? I find that the IO scheduler can have quite an impact on perceived responsiveness on file operations.

Offline

#6 2020-01-09 17:48:03

sabroad
Member
Registered: 2015-05-24
Posts: 242

Re: [Solved] Copying or moving files causes unnecessary swapping

SandaruLJ wrote:

And when the system is swapping, it keeps swapping in and out constantly until the file operation is done, making the system less responsive.

This could quite easily be random graphics freezes and have nothing to do with "swapping in". There's little quantitative or qualitative information to go on here.

Try linux-lts and see it if "improves responsiveness" (if defined as lack of freezes). (For comparison, Mint uses linux-5.0 something or another.)

Last edited by sabroad (2020-01-09 17:49:15)


--
saint_abroad

Offline

#7 2020-01-11 01:49:33

SandaruLJ
Member
From: Sri Lanka
Registered: 2019-10-12
Posts: 8

Re: [Solved] Copying or moving files causes unnecessary swapping

V1del wrote:

Which kernels, which IO schedulers? I find that the IO scheduler can have quite an impact on perceived responsiveness on file operations.

Kernel: 5.4.8-arch1-1
IO Scheduler: mq-deadline

I tried switching to every IO scheduler available on Arch (kyber, bfq, none) but there was no difference. Mint also uses mq-deadline.

Offline

#8 2020-01-11 03:16:23

SandaruLJ
Member
From: Sri Lanka
Registered: 2019-10-12
Posts: 8

Re: [Solved] Copying or moving files causes unnecessary swapping

sabroad wrote:

This could quite easily be random graphics freezes and have nothing to do with "swapping in". There's little quantitative or qualitative information to go on here.

Yes. I think this is the problem. Thanks for the link.

sabroad wrote:

Try linux-lts and see it if "improves responsiveness" (if defined as lack of freezes). (For comparison, Mint uses linux-5.0 something or another.)

I will switch to linux-lts and report back with the results.

Offline

#9 2020-01-11 03:26:40

SandaruLJ
Member
From: Sri Lanka
Registered: 2019-10-12
Posts: 8

Re: [Solved] Copying or moving files causes unnecessary swapping

Yep. That was it. When using linux-lts, there is very minimal swap activity during file operations and it doesn't affect the responsiveness of the UI at all. With linux, there was significant swap activity. I guess I will stick to linux-lts until they fix it. Thanks for the responses guys!

Offline

Board footer

Powered by FluxBB