From: Minchan Kim <minchan@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Thomas Gleixner <tglx@linutronix.de>,
Mike Galbraith <umgwanakikbuti@gmail.com>,
Mike Galbraith <efault@gmx.de>
Subject: Re: [PATCH] mm/zsmalloc: Replace bit spinlock and get_cpu_var() usage.
Date: Wed, 29 Sep 2021 12:09:05 -0700 [thread overview]
Message-ID: <YVS50ZXqCk+SS71K@google.com> (raw)
In-Reply-To: <20210929072359.zkzg57gf362tc76m@linutronix.de>
On Wed, Sep 29, 2021 at 09:23:59AM +0200, Sebastian Andrzej Siewior wrote:
> On 2021-09-28 15:47:23 [-0700], Andrew Morton wrote:
> > Rather nasty with all the ifdefs and two different locking approaches
> > to be tested. What would be the impact of simply switching to the new
> > scheme for all configs?
>
> The current scheme uses the lower bit (OBJ_ALLOCATED_TAG) as something
> special which is guaranteed to be zero due to memory alignment
> requirements. The content of the memory, that long, is then used a bit
> spinlock.
>
> Moving it to spinlock_t would consume only 4 bytes of memory assuming
> lockdep is off. It is then 4 bytes less than a long on 64 bits archs.
> So we could do this if nobody disagrees. The spinlock_t has clearly
> advantages over a bit spinlock like the "order" from the qspinlock
> implementation. But then I have no idea what the contention here is.
> With lockdep enabled the struct gets a little bigger which I assume was to
> avoid. But then only debug builds are affected so…
First of all, thanks for the patch, Sebastian.
The zsmalloc is usually used with swap and swap size is normally several
GB above. Thus, adding per-page spinlock is rather expensive so I'd like to
consider the approach as last resort. About the lock contention, it's rare
so spinlock wouldn't help it much.
Let me try changing the bit lock into sleepable lock in PREEMPT_RT with
bigger granuarity.
next prev parent reply other threads:[~2021-09-29 19:09 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
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 [this message]
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=YVS50ZXqCk+SS71K@google.com \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=efault@gmx.de \
--cc=linux-mm@kvack.org \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox