Take a look at our
ThinkPads.com HOME PAGE
For those who might want to contribute to the blog, start here: Editors Alley Topic
Then contact Bill with a Private Message

Optimal settings for Swap, ZSwap etc.?

Linux on ThinkPads
Post Reply
Message
Author
juliaaa
Posts: 13
Joined: Wed Mar 10, 2021 2:01 pm
Location: Mainz, Rheinland-Pfalz Germany

Optimal settings for Swap, ZSwap etc.?

#1 Post by juliaaa » Tue Mar 16, 2021 5:51 pm

Hey,

does anyone know what would be good values for the following Swap, ZSwap etc. settings:


# in /etc/sysctl.conf:

vm.swappiness=20
vm.vfs_cache_pressure=100
vm.dirty_ratio = ??
vm.dirty_background_ratio = ??


# in /etc/default/grub:

zswap.enabled=1
zswap.compressor=lz4
zswap.max_pool_percent=30
zswap.same_filled_pages_enabled=1
zswap.zpool=z3fold


Also, are there any other interesting parameters to tweak?

I've read about 20 articles/tutorials, but I'm still not really sure about the decision-making regarding many of these settings. And there are conflicting statements, too, for example regarding values for vfs_cache_pressure and max_pool_percent or zsfold vs. zmsalloc for compression.

I'm currently running LMDE4 on an old R60 9461-DXG upgraded with a T7400, 4 GB RAM and an SSD. The machine is used mostly for office work, image processing using GIMP and, of course, web browsing using Firefox (which is a terrible resource hogger). Someone recommended using the h264ify addon with which I can now run 720p (not 720p60) YouTube videos and even 1080p with only sporadic hiccups.

Is it possible to make intelligent guesses for these settings according to the hardware specs or do I have to run measurements?

PS.: What I noticed with certain settings is that the left side of the handrest is getting warmer (probably the CPU/GPU). Does this observation make sense, i.e. can some of these settings have significant impact on heat generation?
Last edited by juliaaa on Wed Mar 17, 2021 10:23 am, edited 2 times in total.

RealBlackStuff
Admin Emeritus
Admin Emeritus
Posts: 21974
Joined: Mon Sep 18, 2006 5:17 am
Location: Wexford, Éire
Contact:

Re: Optimal settings for Swap, ZSwap etc.?

#2 Post by RealBlackStuff » Wed Mar 17, 2021 1:22 am

Be courageous, replace Firefox with Brave: https://brave.com/linux/
Still NOT a great day for a Guinness! (the Real Black Stuff). And I have TWO (closed) pubs within 500 meters/yards!
Ireland remains on FULL lockdown until 2nd half of May 2021!
Covid-19: Stay safe, so Mask it or Casket!

juliaaa
Posts: 13
Joined: Wed Mar 10, 2021 2:01 pm
Location: Mainz, Rheinland-Pfalz Germany

Re: Optimal settings for Swap, ZSwap etc.?

#3 Post by juliaaa » Wed Mar 17, 2021 7:36 am

Hey, thanks for the suggestion. Actually, I used to use Brave for a while on Android, but I heard it's collecting personal information in order to feed their own ad network or something. Also, there was some usability issue which is why I dumped it (although that was 2 years ago)...haven't really tried alternative browsers since except the TOR browser bundle. What speaks for the current Brave version?

axur-delmeria
Senior ThinkPadder
Senior ThinkPadder
Posts: 2867
Joined: Mon May 28, 2012 5:49 am
Location: Metro Manila, Philippines

Re: Legit settings for Swap, ZSwap etc.?

#4 Post by axur-delmeria » Wed Mar 17, 2021 7:52 am

Enabling ZSwap adds some CPU load (compressing and decompressing data), though I don't know by how much.

If you want to reduce the temps, then you can try undervolting the CPU.
Daily driver: X220 4291-C91 i7-2620M

Backup: X601 Core 2 Duo T8100
Toy: X60F Core Solo U1300
On loan: X220 4291-P79 i5-2520M
In pieces: two retired but working X61Ts
RIP: 760XD 9546-U9E; X61 7676-A24; and a BOE-Hydis HV121P01-100 in failed SXGA+ mod
:cry:

davidgurvich
Freshman Member
Posts: 97
Joined: Fri Mar 19, 2010 8:07 am
Location: New York, NY

Re: Optimal settings for Swap, ZSwap etc.?

#5 Post by davidgurvich » Wed Mar 17, 2021 10:46 am

Not sure I'd be using ZFS on a laptop. There's no gain for single drive and some overhead. Not surprising that system is running hotter. I think most of the tuning can be left to defaults until you need to do something specific.
Egregious overbidder

axur-delmeria
Senior ThinkPadder
Senior ThinkPadder
Posts: 2867
Joined: Mon May 28, 2012 5:49 am
Location: Metro Manila, Philippines

Re: Optimal settings for Swap, ZSwap etc.?

#6 Post by axur-delmeria » Wed Mar 17, 2021 11:37 am

davidgurvich wrote:
Wed Mar 17, 2021 10:46 am
Not sure I'd be using ZFS on a laptop. There's no gain for single drive and some overhead. Not surprising that system is running hotter. I think most of the tuning can be left to defaults until you need to do something specific.
I think you've gotten confused
It's not the filesystem ZFS, but the in-memory compressed swap cache Zswap. It's useful for systems with low RAM.
Daily driver: X220 4291-C91 i7-2620M

Backup: X601 Core 2 Duo T8100
Toy: X60F Core Solo U1300
On loan: X220 4291-P79 i5-2520M
In pieces: two retired but working X61Ts
RIP: 760XD 9546-U9E; X61 7676-A24; and a BOE-Hydis HV121P01-100 in failed SXGA+ mod
:cry:

natumbri
Posts: 15
Joined: Wed Mar 30, 2016 2:30 am
Location: Melbourne, Australia

Re: Optimal settings for Swap, ZSwap etc.?

#7 Post by natumbri » Sun Mar 28, 2021 4:03 pm

Have you checked out these projects:

https://github.com/ecdye/zram-config
https://github.com/StuartIanNaylor/zram-swap-config

Quite a bit of useful thinking about zram and how to use it. I use it (with Ubuntu Mate) on all my gear.

Cheers
Nik
T43 (2686-A37 + SXGA+) [broken]; T43 (2668-Axx); R51 (2888-KM2)
X60 (1706-MPM); T60 (2623-A11); T60 (1954-A12, SXGA+)
R60 (9459-AQ9, LED mod)
R601 (originally 9459-AQ9, now 42W7822 + T7500 + SSD + SXGA+)
T500 (CTO, T9600, WSXGA+, SSD); X200s (7462-2GC)

Dekks
Senior Member
Senior Member
Posts: 576
Joined: Thu Jun 26, 2014 9:38 am
Location: Birmingham, UK

Re: Optimal settings for Swap, ZSwap etc.?

#8 Post by Dekks » Sat Apr 10, 2021 9:21 pm

juliaaa wrote:
Tue Mar 16, 2021 5:51 pm
Hey,

does anyone know what would be good values for the following Swap, ZSwap etc. settings:


# in /etc/sysctl.conf:

vm.swappiness=20
vm.vfs_cache_pressure=100
vm.dirty_ratio = ??
vm.dirty_background_ratio = ??


# in /etc/default/grub:

zswap.enabled=1
zswap.compressor=lz4
zswap.max_pool_percent=30
zswap.same_filled_pages_enabled=1
zswap.zpool=z3fold


Also, are there any other interesting parameters to tweak?

I've read about 20 articles/tutorials, but I'm still not really sure about the decision-making regarding many of these settings. And there are conflicting statements, too, for example regarding values for vfs_cache_pressure and max_pool_percent or zsfold vs. zmsalloc for compression.

I'm currently running LMDE4 on an old R60 9461-DXG upgraded with a T7400, 4 GB RAM and an SSD. The machine is used mostly for office work, image processing using GIMP and, of course, web browsing using Firefox (which is a terrible resource hogger). Someone recommended using the h264ify addon with which I can now run 720p (not 720p60) YouTube videos and even 1080p with only sporadic hiccups.

Is it possible to make intelligent guesses for these settings according to the hardware specs or do I have to run measurements?

PS.: What I noticed with certain settings is that the left side of the handrest is getting warmer (probably the CPU/GPU). Does this observation make sense, i.e. can some of these settings have significant impact on heat generation?
wrt Zswap you can remove the same_pages_filled line as your only stating the default, it's only use if is you want to switch it off, you could also try lzo as compressor.

to view zswap performance run "sudo grep -R . /sys/kernel/debug/zswap/" or create a bash alias for it to view the zswap cache performance. 30% pool size might be fine for 4G RAM but 2G RAM configs might want to look ar 25%.
Home - Win 10 MSi GF63 Gaming Laptop /Arch GNOME 3/X230 Tablet /X61 [Korean] - Debian 10/T60p - Ubuntu 20.10 Helix 2
Work - Win10/Thinkpad X1 Tablet Gen 2

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “Linux Questions”

Who is online

Users browsing this forum: No registered users and 4 guests