Re: [RFC PATCH] zram: avoid preemption with CPU-based compression backends

From: Barry Song

Date: Thu Aug 13 2026 - 20:07:24 EST


On Wed, Aug 5, 2026 at 3:31 PM Sergey Senozhatsky
<senozhatsky@xxxxxxxxxxxx> wrote:
>
> On (26/08/05 08:55), Barry Song (Xiaomi) wrote:
> > @@ -128,14 +128,20 @@ struct zcomp_strm *zcomp_stream_get(struct zcomp *comp)
> > * so then unlock and re-try on the current CPU.
> > */
> > mutex_lock(&zstrm->lock);
> > + if (!comp->ops->async && !IS_ENABLED(CONFIG_PREEMPT_RT))
> > + preempt_disable();
>
> We take slot_lock(), which is preemptible, under stream lock on
> some paths.

Hi Sergey,

As promised in [1], those patches are still under testing on real
Android phones. However, I'm quite curious which path takes
slot_lock while holding the zstream lock. My initial testing shows
that this path doesn't seem to be exercised at all. Also, after
inspecting the code, I couldn't find any path that does this.

[1] https://lore.kernel.org/all/CAGsJ_4wd60ok7BF9XGRiO6dvddkaYTziPV-Bxq+3mA+-c7MvQA@xxxxxxxxxxxxxx/

Best Regards
Barry