On 6/4/24 8:01 PM, Yosry Ahmed wrote: > On Tue, Jun 4, 2024 at 10:54 AM Yu Zhao <yuzhao@xxxxxxxxxx> wrote: >> There was a lot of user memory in the DMA zone. So at a point the >> highmem zone was full and allocation fallback happened. >> >> The problem with zone fallback is that recent allocations go into >> lower zones, meaning they are further back on the LRU list. This >> applies to both user memory and zsmalloc memory -- the latter has a >> writeback LRU. On top of this, neither the zswap shrinker nor the >> zsmalloc shrinker (compaction) is zone aware. So page reclaim might >> have trouble hitting the right target zone. > > I see what you mean. In this case, yeah I think the internal > fragmentation in the zsmalloc pools may be the reason behind the > problem. > > How many CPUs does this machine have? I am wondering if 32 can be an > overkill for small machines, perhaps the number of pools should be > max(nr_cpus, 32)? > > Alternatively, the number of pools should scale with the memory size > in some way, such that we only increase fragmentation when it's > tolerable. Sounds like a good idea to me, maybe a combination of both. No point in trying to scale if there's no benefit and only downside of more memory consumption.