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

Sergey Senozhatsky <[email protected]> Wed, 5 Aug 2026 16:30:49 +0900
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <[email protected]>
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.

>  		if (likely(zstrm->buffer))
>  			return zstrm;
>  		mutex_unlock(&zstrm->lock);
>  	}
>  }