Re: [PATCH v8 14/17] zram: permit reclaim in zstd custom allocator
From: Sergey Senozhatsky
Date: Mon Feb 24 2025 - 23:43:09 EST
On (25/02/24 10:10), Sebastian Andrzej Siewior wrote:
> On 2025-02-22 07:25:45 [+0900], Sergey Senozhatsky wrote:
> > static void *zstd_custom_alloc(void *opaque, size_t size)
> > {
> > - if (!preemptible())
> > + /* Technically this should not happen */
> > + if (WARN_ON_ONCE(!preemptible()))
> > return kvzalloc(size, GFP_ATOMIC);
>
> This check works only on preemptible kernels.
I'm not sure this is true.
> If you run this on !PREEMPTIBLE kernels, preemptible() reports always 0
> so that WARNING will always trigger there.
I thought that preemptible() depends on PREEMPT_COUNT, not on
PREEMPTIBLE, because even on !PREEMPTIBLE preempt-count still
holds hard/soft irq counts, etc.
I ran CONFIG_PREEMPT_NONE=y zram-zstd tests and didn't see any
warnings.