Re: [PATCH] mm/zsmalloc: remove shrinker

From: Sergey Senozhatsky

Date: Wed Dec 02 2026 - 23:58:29 EST


On (26/12/03 04:42), Chris Wiseman wrote:
> Hi Sergey, Barry, Nanzhe, Andrew,
>
> Barry, Nanzhe, thanks for the Pixel 6 numbers. 32 MB to 182 MB median
> (622 MB peak) is a real regression, so the shrinker removal shouldn't go
> in alone.
>
> Sergey, moving compaction to a background worker gated on
> zs_pool_can_compact() looks good to me. Three quick things on the
> sketch:
>
> 1. Can we make compact_threshold writable after init (like mem_limit)
> instead of returning -EBUSY? Android needs to tune it live without
> resetting zram. That'll just need WRITE_ONCE() in the store and
> READ_ONCE() in zram_schedule_compaction(), since slot_free() doesn't
> hold dev_lock.

Sure. I didn't want to complicate the patch. It can be run-time
tunable.

> 2. If it defaults to 0, removing the shrinker regresses anyone who
> doesn't know the knob exists. We should pick a non-zero default from
> data rather than guessing. Barry, Nanzhe, could you test 5 and 10 on
> that same Pixel 6 loop?

Right. I guess 5 is a good default.

> 3. The 10-second timer doesn't know about memory pressure, whereas the
> shrinker ran when reclaim wanted pages. Not a blocker, just the first
> thing I'd watch if the Pixel numbers don't come back down.

So that 10 seconds cooldown is there because those slot-free calls don't
come alone, usually. It's more likely to be a burst of slot-free's and
10 seconds wait kind of tries to space them (burst and compaction) out.

> Andrew, please drop mm-zsmalloc-remove-shrinker.patch from mm-new for
> now. Once we have the Pixel 6 numbers, we can send a 2-patch series
> with Sergey's patch first and the shrinker removal second so git bisect
> doesn't hit a regressing commit. Sergey, happy to carry your patch or
> rebase mine on top of yours, whichever you prefer.

I think your patch will go in as is, no need to rebase, the remaining
work will stack on top of it. I guess we want shrinker replacement,
just need to figure out what do we replace it with.