All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Minchan Kim <minchan@kernel.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] mm: Disable zsmalloc on PREEMPT_RT
Date: Fri, 24 Sep 2021 09:08:25 +0200	[thread overview]
Message-ID: <20210924070825.zqsi7hxgtojd67wv@linutronix.de> (raw)
In-Reply-To: <YU0IkoeWYLdll6/+@google.com>

On 2021-09-23 16:06:58 [-0700], Minchan Kim wrote:
> On Thu, Sep 23, 2021 at 07:01:21PM +0200, Sebastian Andrzej Siewior wrote:
> > For efficiency reasons, zsmalloc is using a slim `handle'. The value is
> > the address of a memory allocation of 4 or 8 bytes depending on the size
> > of the long data type. The lowest bit in that allocated memory is used
> > as a bit spin lock.
> > The usage of the bit spin lock is problematic because with the bit spin
> > lock held zsmalloc acquires a rwlock_t and spinlock_t which are both
> > sleeping locks on PREEMPT_RT and therefore must not be acquired with
> > disabled preemption.
> 
> I am not sure how long the preemption disabled section takes since it
> just disable for a page copy mostly.

after the bit-spin-lock, there are sleeping locks. These are
problematic.

> > 
> > There is a patch which extends the handle on PREEMPT_RT so that a full
> > spinlock_t fits (even with lockdep enabled) and then eliminates the bit
> > spin lock. I'm not sure how sensible zsmalloc on PREEMPT_RT is given
> > that it is used to store compressed user memory.
> 
> I don't see what's relation between PREEMPT_RT and compressed user
> memory so you can reach such conclustion. Disable zsmalloc also makes
> disable zram. I think in-compress memory swap rather than storage
> swap/block sometimes would be useful for even RT.

The only user of zsmalloc I found was zswap which compressed user pages.
Maybe I didn't collect all the dots.

> > Disable ZSMALLOC on PREEMPT_RT. If there is need for it, we can try to
> > get it to work.
> 
> Please send the patch which extends handle with spin_lock rather than
> simply disabing.

Okay. I will clean it up a little and post it then.

Sebastian


  reply	other threads:[~2021-09-24  7:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 17:01 [PATCH] mm: Disable zsmalloc on PREEMPT_RT Sebastian Andrzej Siewior
2021-09-23 23:06 ` Minchan Kim
2021-09-24  7:08   ` Sebastian Andrzej Siewior [this message]
2021-09-28  8:44   ` [PATCH] mm/zsmalloc: Replace bit spinlock and get_cpu_var() usage Sebastian Andrzej Siewior
2021-09-28 22:47     ` Andrew Morton
2021-09-29  2:11       ` Mike Galbraith
2021-09-29  7:23       ` Sebastian Andrzej Siewior
2021-09-29 19:09         ` Minchan Kim
2021-09-30  6:42           ` Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210924070825.zqsi7hxgtojd67wv@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.