[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250227131940.6yzjRQmL@linutronix.de>
Date: Thu, 27 Feb 2025 14:19:40 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Yosry Ahmed <yosry.ahmed@...ux.dev>,
Hillf Danton <hdanton@...a.com>, Kairui Song <ryncsn@...il.com>,
Minchan Kim <minchan@...nel.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 14/17] zram: permit reclaim in zstd custom allocator
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
Powered by blists - more mailing lists