Re: [PATCH v8 14/17] zram: permit reclaim in zstd custom allocator

From: Sebastian Andrzej Siewior
Date: Mon Feb 24 2025 - 04:22:34 EST


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.
If you run this on !PREEMPTIBLE kernels, preemptible() reports always 0
so that WARNING will always trigger there.

> - return kvzalloc(size, __GFP_KSWAPD_RECLAIM | __GFP_NOWARN);
> + return kvzalloc(size, GFP_NOIO | __GFP_NOWARN);
> }
>
> static void zstd_custom_free(void *opaque, void *address)
> --
> 2.48.1.601.g30ceb7b040-goog
>

Sebastian