On 2025-02-25 13:42:55 [+0900], Sergey Senozhatsky wrote: > 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. Yes. The preempt count is always there to hold NMI/ HARDIRQ/ SOFTIRQ. However only on a preemptible (that is with PREEMPT_COUNT) kernel preempt_disable() does something. So on !PREEMPTIBLE kernel you don't see spin_lock() or preempt_disable() reflect in preempt_count. Unless you enable debugging which force this option into a non-preemptible kernel. > I ran CONFIG_PREEMPT_NONE=y zram-zstd tests and didn't see any > warnings. Sebastian