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: 23825
Joined: Mon Sep 18, 2006 5:17 am
Location: Loch Garman, Éire

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/
Lovely day for a Guinness! (The Real Black Stuff)

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: 3832
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.
Planned Purchase: T480s i5-8350 FHD Touch
Impulse Buy: Thinkpad not named for safety reasons :lol:
RIP: X220 4291-C91 X61 7676-A24 760XD-U9E :cry:

davidgurvich
Freshman Member
Posts: 99
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: 3832
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.
Planned Purchase: T480s i5-8350 FHD Touch
Impulse Buy: Thinkpad not named for safety reasons :lol:
RIP: X220 4291-C91 X61 7676-A24 760XD-U9E :cry:

natumbri
Posts: 18
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+ LED mod)
R60 (9459-AQ9, LED mod); T500 (CTO, T9600, WSXGA+, SSD)
R601 (originally 9459-AQ9, now 42W7822 + T7500 + SSD + SXGA+)
X200s (7462-2GC); X201 (3626-C22); X220 (4290-CTO, i7)

Dekks
Senior Member
Senior Member
Posts: 583
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 17 guests