Re: [PATCH] mm/zsmalloc: remove shrinker

From: Sergey Senozhatsky

Date: Wed Dec 02 2026 - 22:09:08 EST


Hi Barry,

On (26/12/02 18:21), Barry Song wrote:
> > > Hi Chris, Xueyuan and all,
> > >
> > > Thanks for the patch and the report. Just curious, do we need
> > > userspace-triggered proactive compaction
> >
> > Wouldn't hurt to keep it around, I guess. But maybe can NOOP it
> > in the future (removing zram device attributes is a bit difficult,
> > we usually give around 3-5 years of deprecation cooldown period
> > before removal.)
>
> Hi Sergey,
>
> Thanks for your reply. Sorry, I might not have expressed my question
> clearly. Here is what I meant:

Oh, my bad!

> We used to have automatic compaction through the shrinker. Now that
> we have removed it, do we still expect compaction to be triggered,
> either automatically or manually by writing to the zram sysfs
> attribute?
>
> I know the changelog already says:
>
> " Testing on ARM64 QEMU shows that removing the shrinker eliminates
> mid-swap compaction churn without increasing active pool memory
> usage for either zram or zswap."
>
> But what about periods when swap-out is not active? Would compaction
> still be beneficial in those cases?

I suppose compaction will be beneficial after a huge app swap-in, e.g.
bringing back a web browser with (usual) million tabs. Or after a huge
app kill/termination, if the app had swap presence. Both of these
release memory from zsmalloc and create fragmentation, so we might
benefit from doing a de-fragmentation.