You are not logged in.
UPD: everything below except the laptop info is irrelevant since it turned out to be not zram's fault.
How I've setup zram:
- installed zram-generator from arch repos
- echo `[zram0]` into `/etc/systemd/zram-generator.conf`
- reloaded the `systemd-zram-setup@zram0`
- created `/etc/sysctl.d/99-vm-zram-parameters.conf` file with following contents:
vm.swappiness = 180 # increase percentage to start using zram earlier
vm.watermark_boost_factor = 0
vm.watermark_scale_factor = 125
vm.page-cluster = 0
vm.oom_kill_allocating_task = 1- rebooted
After all that zram works like a charm. On my laptop with ~15G ram i really feel better having zram UNLESS 2 conditions are met: laptop is charging and there is part of any currently running game offloaded to zram. Then the whole system performance drops drastically. As soon as i unplug the charging cable fps goes normal and system perfomance as well. Doesn't matter what the current charging level is - 30 or 80. Happens always. The laptop doesn't switch to integrated graphics, doesn't change profile to `power-saver`, 'performance' in powerprofilesctl isn't shown as 'Degraded', temperatures on both cpu and gpu are below 80.
Laptop info:
Zenbook UM5302TA_UM5302TA 1.0
6.9.9-arch1-1
CPU: AMD Ryzen 7 6800U with Radeon Graphics (16) @ 4.768GHz
GPU: AMD ATI Radeon 680M
Games i tested this on:
- Warframe
- Apocalypse Party
Last edited by earthian (2024-07-22 17:25:28)
Offline
have you tried traditional swap on its own partition instead?
allthough the change between getting charged/power on ac vs battery is quite interesting
Offline
No, i haven't tried the traditional swap. One of the main reasons i went for zram is because i didn't want to repartition my disc to have swap. And i like the fact that you can setup and disable zram whenever.
Offline
What's the limiting factor, GPU or CPU?
https://wiki.archlinux.org/title/Benchmarking
time echo "scale=5000; a(1)*4" | bc -lcan serve as basic CPU test (don't post the result, the number should look familiar - only the time it takes is relevant)
Does it /have/ to be the game data in zram or will any active data in zram do?
Why does the game get swapped out anyway?
Plugging the charger will do *something*, do you run stuff like TLP etc.?
Do the actual CPU frequencies drop (see tip in https://wiki.archlinux.org/title/CPU_fr … _governors )?
Online
`time echo "scale=5000; a(1)*4" | bc -l` results:
System on battery, nothing in zram, game not running:
echo "scale=5000; a(1)*4" 0.00s user 0.00s system 57% cpu 0.001 total
bc -l 11.61s user 0.00s system 99% cpu 11.642 total
System charging, game running, something is in zram:
echo "scale=5000; a(1)*4" 0.00s user 0.00s system 56% cpu 0.002 total
bc -l 34.86s user 0.09s system 98% cpu 35.415 total
System on battery, game still running, but fps in game is back to normal:
echo "scale=5000; a(1)*4" 0.00s user 0.00s system 46% cpu 0.002 total
bc -l 33.96s user 0.05s system 98% cpu 34.457 total
No, it doesn't have to be game data at all, i made baseless statement. Let me correct myself - if there is _anything_ in zram. To be even more precise - there was like 6-7mb of data in zram right after i booted, but it didn't affect system performance. Only when there was more data in zram the system performance loss started to happen. As a reference, plugging AC when on these values drops fps a lot:
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 zstd 4G 1.4G 391.6M 429.6M 16 [SWAP]
Used `watch cat /sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq` command to monitor cpu speed. No difference on BAT or on AC.
Offline
And no, i don't run anything of importance that i know of like TLP etc. when i plug in the AC
Offline
There's no drastic difference in CPU time for bc while the game is running on AC or battery.
I could see the shared VRAM being an issue, but not the relation to the power supply - does
cat /sys/class/drm/card0/device/pp_dpm_mclk differ between battery and AC?
(might be card1 b/c of the simpledrm device), https://wiki.archlinux.org/title/AMDGPU#Overclocking
Online
Same result for both - AC and BAT:
cat /sys/class/drm/card1/device/pp_dpm_mclk:
1 │ 0: 400Mhz
2 │ 1: 800Mhz *
3 │ 2: 800Mhz *
4 │ 3: 800Mhz *
Meanwhile i will try to disable zram and play as i normally do, using the system same way i was facing the performance issues with zram to make sure its zram's fault. Because yes, i disabled the zram, rebooted, went gaming and things were ok, but maybe i was lucky and this can happen even without zram..
Offline
Ok, its my bad conclusion making, but consistently having this issue, then disabling zram, rebooting and not having the issue made me think that zram was to blame but apparently i got lucky and something else is the problem. Because now i disabled zram again and faced exactly the same issue with performance loss when laptop is charging. Should i mark this one as solved and create another topic with corrected heading? or rename this one?
Offline
Probably just change the subject.
Is the external power supply just an adapter or some sort of dock?
"vblank_mode=0 glxgears" should run at unlimited FPS, does that drop off when you connect the external power?
Online
External power supply is just normal adapter, 60W, xiaomi small one, type-c type-c.
System performance normal, no AC plugged, no game running:
```
ATTENTION: default value of option vblank_mode overridden by environment.
50826 frames in 5.0 seconds = 10165.183 FPS
81382 frames in 5.0 seconds = 16276.282 FPS
78884 frames in 5.0 seconds = 15776.782 FPS
77280 frames in 5.0 seconds = 15455.867 FPS
```
While low system performance (while game running), AC plugged:
```
vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
228 frames in 5.0 seconds = 45.597 FPS
272 frames in 5.0 seconds = 54.194 FPS
284 frames in 5.0 seconds = 56.783 FPS
```
As soon as i unplug the AC (game still running), performance and fps in game goes back to normal instantly. That's the output of the glxgears:
```
❯ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
3867 frames in 5.0 seconds = 773.336 FPS
4241 frames in 5.0 seconds = 847.020 FPS
3272 frames in 5.0 seconds = 654.387 FPS
```
Last edited by earthian (2024-07-21 14:39:28)
Offline
Looks promising but please try w/o the game in the bg - we want to know whether the pure GPU performance collapses when this happens and right now it's not possible to say whether glxgears is impacted by something the game does.
Yuo're looking at something in the area of https://wiki.archlinux.org/title/AMDGPU … nce_levels
Online
Ok, no game running in background now. Running while AC plugged in, low system performance (without game running tho its not noticable at all since i am on hybrid laptop and video chip isn't used by compositor):
```
❯ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
44874 frames in 5.0 seconds = 8974.461 FPS
49572 frames in 5.0 seconds = 9914.102 FPS
49616 frames in 5.0 seconds = 9923.081 FPS
40310 frames in 5.0 seconds = 8061.808 FPS
^C
vblank_mode=0 glxgears 8.38s user 10.74s system 91% cpu 20.870 total
```
Running right after i unplugged the AC:
```
❯ vblank_mode=0 glxgears
ATTENTION: default value of option vblank_mode overridden by environment.
53984 frames in 5.0 seconds = 10796.720 FPS
71911 frames in 5.0 seconds = 14382.197 FPS
70108 frames in 5.0 seconds = 14021.530 FPS
70077 frames in 5.0 seconds = 14015.254 FPS
^C
vblank_mode=0 glxgears 9.05s user 11.78s system 93% cpu 22.403 total
```
Last edited by earthian (2024-07-22 17:03:42)
Offline
Ok, setting 'high' in /sys/class/drm/card1/device/power_dpm_force_performance_level (was 'auto') maybe fixed the problem, but i will test it a bit longer to not the repeat the same mistake with 'occasional' success. If i won't see any fps drops no more i will mark this thread as solved. Thank you for your patience and help, seth!
Last edited by earthian (2024-07-22 17:14:14)
Offline