You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After using linux-zen kernel for more than a year I realized that my system uses swap not in order that is optimized in any way.
I realized that my ram usage is always around 69% (yes I'm curious and that's funny) that was because when my ram gets around 50% usage the kernel will start using swappiness and when it gets to 69% nearly all other allocations would move some pages to swap until my swap gets nearly full and the kernel will fill ram again, but my swappiness was 1 and no matter value value it has, the kernel will always do that.
And as soon as I switched to vanilla linux kernel the problem went away.
I wonder if this functionality is intended or not?
I use the latest version of both kernels which comes in arch Linux repositories
Because I use linux-zen because waydroid only works with kernels which come with binder modules and linux-zen has it.
Thanks for your great efforts
Is this impacting the responsiveness of your system? Using swap in and of itself is not a problem unless it's actively causing issues with running applications.
We have some patches in our zen-sauce branch that affect swappiness. For the most part, proactive compaction and other aggressive reclaim/compaction behavior is disabled since it disrupts foregrounds tasks too much under memory pressure. What you're seeing instead is that memory is pushed to swap preemptively as a side effect.
Is this impacting the responsiveness of your system? Using swap in and of itself is not a problem unless it's actively causing issues with running applications.
We have some patches in our zen-sauce branch that affect swappiness. For the most part, proactive compaction and other aggressive reclaim/compaction behavior is disabled since it disrupts foregrounds tasks too much under memory pressure. What you're seeing instead is that memory is pushed to swap preemptively as a side effect.
Yes it does actually affect my system responsiveness a lot
Because I use 4 or 5 apps in foreground apps at the same time
I have more than enough RAM for them (16GB but the apps are not that heavy) but It does move my active memory to swap and that hurts performance in my case
I have been in Linux vanilla kernel after posting the issue till now and I really like it, the performance is much better here even when my whole ram and swap gets filled up
e33a55b - disabling compaction of unevictable pages, possibly could be related? This follows guidance from adjustments when PREEMPT_RT is turned on in ifdef macros. Restore with sudo sysctl -w vm.compact_unevictable_allowed=1
47aa999 - proactive compaction causes stalls in foreground applications if set too aggressive. Even at light settings I had problems with it so we use kerneltoast's patch. You can restore the default with sudo sysctl -w vm.compaction_proactiveness=20.
627d13a - disabling watermark boosting is similar in effect of disabling proactive compaction. Restore to default with sudo sysctl -w vm.watermark_boost_factor=15000
1b4743e - protecting cache of data accessed in the last second, probably not related but you can tune in the value in /sys/kernel/mm/lru_gen/min_ttl_ms and restore it to 0 for testing.
I have with the zen kernel almost not functinally swapiness value, its just didnt worked, i have set it to 200, but then after i used kerneltoast defconfig and all his patches without the thermal stuff on 6.11, swapiness value worked. And also i build Android and ram is exactly that whats needed sometimes on mass. Just want to say after his arch_defconfig and all his patches, the swap or zram i use, is much better now. I dont have to wait now that long when zram is used. Normally i would have to wait longer in the default kernel settings, when android.pb build starts, this is the part which i dont like cause normally it would take a long time, but now after the patches and the defconfig its much better. I dont have to wait that long now. It clearly improved something. It was the kernel_86_leptop from kerneltoast aka sultan
@A404M What swapiness value you have? when i have 200, it will most likely use the swap or zram more, but when its low like 10 it should be use ram before its getting full and then start using swap.
I tested and it behaves like nothing has happend, its almost too late for swaping, on my self build zenkernel, also with latest changes it dont does that. I think this is something relevant in the defconfig, but for now i dont know which exactly
I dont find that option in /sys/kernel/mm/lru_gen, have only: ksm swap transparent_hugepage in mm folder.
Right now on my self build, i have just used some stuff of sultans x86 kernel. In the normal kernel i tested a moment ago it also stutters when here its fine, i think its worth looking in the defconfig, i just mergerd everything that make sense too me and now its good, he knows how to toast a kernel haha
So your self build isn't using MG-LRU? What I was asking is on a Zen or Liquorix kernel, set /sys/kernel/mm/lru_gen/enabled to "n" and see if you can reproduce the issues you're running into.
You can also adjust /sys/kernel/mm/lru_gen/min_ttl_ms to 0 to reproduce stock.
What I'm trying to figure out is if MG-LRU itself is an issue here as you don't enable it with @kerneltoast's. If it is, we need to figure out what's going on with it.
So your self build isn't using MG-LRU? What I was asking is on a Zen or Liquorix kernel, set /sys/kernel/mm/lru_gen/enabled to "n" and see if you can reproduce the issues you're running into.
You can also adjust /sys/kernel/mm/lru_gen/min_ttl_ms to 0 to reproduce stock.
What I'm trying to figure out is if MG-LRU itself is an issue here as you don't enable it with @kerneltoast's. If it is, we need to figure out what's going on with it.
FYI, I disable mglru in my laptop kernel defconfig.
@A404M next linux-zen release will reapply a patch we reverted and disable zswap compressed cache by default. Can you also confirm that zswap.enable=0 helps on your system?
Ok, I'm going to mark this as resolved. @A404M if this didn't help and you're still having problems, let us know and we'll reopen.
I'm sorry for not being active here
I have some problems at job and I can't take a break even for a day to do the works you mentioned.
I guess the best thing is to close this issue and I will recheck when I got free time.
I'm sorry again for not answering😞
Has anyone reached out to the kernel zswap maintainers about this behavior?
Not that I'm aware of, but for whoever reports, a script or series of instructions to reproduce the issue reliably will be important. More importantly you want whatever utility you're running to have numbers that indicate the "stutter" and "jank", otherwise it's hard for maintainers to prioritize a solution.
This is resolved by 856c387, where lru_gen_min_ttl parameter was causing early OOMs and excessive swapping. Proactive compaction restore to default will also stay while we determine a non-zero value for interactive systems.
Activity
damentz commentedon Aug 20, 2024
Is this impacting the responsiveness of your system? Using swap in and of itself is not a problem unless it's actively causing issues with running applications.
We have some patches in our
zen-saucebranch that affect swappiness. For the most part, proactive compaction and other aggressive reclaim/compaction behavior is disabled since it disrupts foregrounds tasks too much under memory pressure. What you're seeing instead is that memory is pushed to swap preemptively as a side effect.heftig commentedon Aug 20, 2024
I do wonder what causes the ZEN kernel to swap so aggressively even with its default settings and plenty of unused RAM.
Though I don't remember how the vanilla kernel behaves.
A404M commentedon Aug 21, 2024
Yes it does actually affect my system responsiveness a lot
Because I use 4 or 5 apps in foreground apps at the same time
I have more than enough RAM for them (16GB but the apps are not that heavy) but It does move my active memory to swap and that hurts performance in my case
I have been in Linux vanilla kernel after posting the issue till now and I really like it, the performance is much better here even when my whole ram and swap gets filled up
damentz commentedon Aug 21, 2024
There's a few commits that could be the problem:
@A404M would you be able to try testing the tunables to see if they're related? Worst case it's the first commit I mentioned. Speaking of which, we've been rebasing these patches for a while now, might be worth seeing if anything has changed in kerneltoast's current branch: https://github.com/kerneltoast/kernel_x86_laptop/commits/v6.10-sultan/
damentz commentedon Sep 29, 2024
@A404M have you had a chance to tweak any of the files/sysctls I referenced?
A404M commentedon Oct 3, 2024
@damentz I haven't had the time to try it
But tomorrow is my day off, I will try it then
Sorry for the delay
pckotzer commentedon Oct 6, 2024
I have with the zen kernel almost not functinally swapiness value, its just didnt worked, i have set it to 200, but then after i used kerneltoast defconfig and all his patches without the thermal stuff on 6.11, swapiness value worked. And also i build Android and ram is exactly that whats needed sometimes on mass. Just want to say after his arch_defconfig and all his patches, the swap or zram i use, is much better now. I dont have to wait now that long when zram is used. Normally i would have to wait longer in the default kernel settings, when android.pb build starts, this is the part which i dont like cause normally it would take a long time, but now after the patches and the defconfig its much better. I dont have to wait that long now. It clearly improved something. It was the kernel_86_leptop from kerneltoast aka sultan
@A404M What swapiness value you have? when i have 200, it will most likely use the swap or zram more, but when its low like 10 it should be use ram before its getting full and then start using swap.
damentz commentedon Oct 22, 2024
Maybe the issue was MG-LRU? A patch just arrived in v6.11.5 that fixes an early OOM under swap pressure: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.11.5&id=8d4f2d8ca9e29fe7461734dab1aa50a89a7768bd
EDIT: It looks like there's two patches in v6.11.5
@pckotzer @A404M, please try testing once you're running Zen based on v6.11.5+
pckotzer commentedon Oct 26, 2024
Installing liqu kernel will also work @damentz ?
damentz commentedon Oct 27, 2024
Yes, Liquorix has the same configuration for memory as Zen Kernel.
pckotzer commentedon Oct 28, 2024
I tested and it behaves like nothing has happend, its almost too late for swaping, on my self build zenkernel, also with latest changes it dont does that. I think this is something relevant in the defconfig, but for now i dont know which exactly
damentz commentedon Oct 28, 2024
@pckotzer can you try disabling MG-LRU? You can make the change realtime in /sys/kernel/mm/lru_gen I believe, or in the folder above it.
pckotzer commentedon Oct 28, 2024
I dont find that option in /sys/kernel/mm/lru_gen, have only: ksm swap transparent_hugepage in mm folder.
Right now on my self build, i have just used some stuff of sultans x86 kernel. In the normal kernel i tested a moment ago it also stutters when here its fine, i think its worth looking in the defconfig, i just mergerd everything that make sense too me and now its good, he knows how to toast a kernel haha
damentz commentedon Oct 28, 2024
So your self build isn't using MG-LRU? What I was asking is on a Zen or Liquorix kernel, set /sys/kernel/mm/lru_gen/enabled to "n" and see if you can reproduce the issues you're running into.
You can also adjust /sys/kernel/mm/lru_gen/min_ttl_ms to 0 to reproduce stock.
What I'm trying to figure out is if MG-LRU itself is an issue here as you don't enable it with @kerneltoast's. If it is, we need to figure out what's going on with it.
kerneltoast commentedon Oct 28, 2024
FYI, I disable mglru in my laptop kernel defconfig.
9 remaining items
damentz commentedon Nov 8, 2024
@heftig looks like we should turn off zswap by default as it hinders responsiveness under load.
Also, maybe we should restore this commit since it didn't make a difference? 573d80b
config: Disable zswap compressed cache by default
Reapply "ZEN: mm: Stop kswapd early when nothing's waiting for it to …
damentz commentedon Nov 11, 2024
@A404M next linux-zen release will reapply a patch we reverted and disable zswap compressed cache by default. Can you also confirm that zswap.enable=0 helps on your system?
damentz commentedon Nov 17, 2024
Ok, I'm going to mark this as resolved. @A404M if this didn't help and you're still having problems, let us know and we'll reopen.
A404M commentedon Nov 17, 2024
I'm sorry for not being active here
I have some problems at job and I can't take a break even for a day to do the works you mentioned.
I guess the best thing is to close this issue and I will recheck when I got free time.
I'm sorry again for not answering😞
config: Disable ZSWAP_DEFAULT_ON
ReillyBrogan commentedon Nov 20, 2024
Has anyone reached out to the kernel zswap maintainers about this behavior?
damentz commentedon Nov 21, 2024
Not that I'm aware of, but for whoever reports, a script or series of instructions to reproduce the issue reliably will be important. More importantly you want whatever utility you're running to have numbers that indicate the "stutter" and "jank", otherwise it's hard for maintainers to prioritize a solution.
damentz commentedon Dec 5, 2024
Reopening while we experiment with different methods to prevent excessive swapping.
Merge branch '6.12/zen-sauce' into 6.12/main
damentz commentedon Dec 10, 2024
This is resolved by 856c387, where lru_gen_min_ttl parameter was causing early OOMs and excessive swapping. Proactive compaction restore to default will also stay while we determine a non-zero value for interactive systems.