[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 20 Dec 2020 02:56:18 +0100
From: Mike Galbraith <efault@....de>
To: Vitaly Wool <vitaly.wool@...sulko.com>,
LKML <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>
Cc: Barry Song <song.bao.hua@...ilicon.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Minchan Kim <minchan@...nel.org>,
NitinGupta <ngupta@...are.org>
Subject: Re: [PATCH] zsmalloc: do not use bit_spin_lock
On Sun, 2020-12-20 at 02:22 +0200, Vitaly Wool wrote:
> zsmalloc takes bit spinlock in its _map() callback and releases it
> only in unmap() which is unsafe and leads to zswap complaining
> about scheduling in atomic context.
>
> To fix that and to improve RT properties of zsmalloc, remove that
> bit spinlock completely and use a bit flag instead.
> -static void pin_tag(unsigned long handle) __acquires(bitlock)
> +static void pin_tag(unsigned long handle)
> {
> - bit_spin_lock(HANDLE_PIN_BIT, (unsigned long *)handle);
> + preempt_disable();
> + while(test_and_set_bit(HANDLE_PIN_BIT, (unsigned long *)handle))
> + cpu_relax();
> + preempt_enable();
> }
If try doesn't need to disable preemption, neither does pin.
-Mike
Powered by blists - more mailing lists