From: Davidlohr Bueso <dave@stgolabs.net>
To: Minchan Kim <minchan@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
linux-mm <linux-mm@kvack.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Mike Galbraith <umgwanakikbuti@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 8/8] zsmalloc: replace get_cpu_var with local_lock
Date: Sun, 14 Nov 2021 19:56:47 -0800 [thread overview]
Message-ID: <20211115035647.oh3wf6avptlo565k@offworld> (raw)
In-Reply-To: <20211110185433.1981097-9-minchan@kernel.org>
On Wed, 10 Nov 2021, Minchan Kim wrote:
>From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
>The usage of get_cpu_var() in zs_map_object() is problematic because
>it disables preemption and makes it impossible to acquire any sleeping
>lock on PREEMPT_RT such as a spinlock_t.
>Replace the get_cpu_var() usage with a local_lock_t which is embedded
>struct mapping_area. It ensures that the access the struct is
>synchronized against all users on the same CPU.
On a similar note (and sorry for hijacking the thread) I've been looking
at the remaining users of get_cpu_light() in a hope to see them upstreamed
and removed out-of-tree now that we have local locks.
There are six, and afaict, they can be addressed with either using local
locks:
1. netif_rx. We can add a local_lock_t to softnet_data which is the pcpu
data strucutre used by enqueue_to_backlog(). Then replace both preempt_disable
and get_cpu with local_lock(&softnet_data.lock).
2. blk-mq. Such scenarios rely on implicitly disabling preemption to guarantee
running __blk_mq_run_hw_queue() on the right CPU. But we can use a local lock
for synchronous hw queue runs, thus adding a local_lock_t to struct blk_mq_hw_ctx.
3. raid5. We can add a local_lock_t to struct raid5_percpu.
4. scsi/fcoe. There are 3 things here to consider: tx stats management,
fcoe_percpu_s and the exchange manager pool. For the first two adding
a local_lock_t to fc_stats and fcoe_percpu_s should do it, but we would
have to do a migrate_disable() for pool case in fc_exch_em_alloc() which
yes is ugly... pool->lock is already there.
... or flat-out migrate_disabling when the per-CPU data structure already
has a spinlock it acquires anyway, which will do the serialization:
5. vmalloc. Since we already have a vmap_block_queue.lock
6. sunrpc. Since we already have a pool->sp_lock.
I've got patches for these but perhaps I'm missing a fundamental reason as
to why these are still out-of-tree and get_cpu()-light family is still around.
For example, direct migrate_disable() calls are frowned upon and could well
be unacceptable - albeit it's recent user growth upstream.
Thoughts?
Thanks,
Davidlohr
next prev parent reply other threads:[~2021-11-15 3:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-10 18:54 [PATCH 0/8] zsmalloc: remove bit_spin_lock Minchan Kim
2021-11-10 18:54 ` [PATCH 1/8] zsmalloc: introduce some helper functions Minchan Kim
2021-11-10 18:54 ` [PATCH 2/8] zsmalloc: rename zs_stat_type to class_stat_type Minchan Kim
2021-11-10 18:54 ` [PATCH 3/8] zsmalloc: decouple class actions from zspage works Minchan Kim
2021-11-10 18:54 ` [PATCH 4/8] zsmalloc: introduce obj_allocated Minchan Kim
2021-11-10 18:54 ` [PATCH 5/8] zsmalloc: move huge compressed obj from page to zspage Minchan Kim
2021-11-10 18:54 ` [PATCH 6/8] zsmalloc: remove zspage isolation for migration Minchan Kim
2021-11-10 18:54 ` [PATCH 7/8] zsmalloc: replace per zpage lock with pool->migrate_lock Minchan Kim
2021-11-11 9:07 ` Sebastian Andrzej Siewior
2021-11-11 23:11 ` Minchan Kim
2021-11-12 7:28 ` Sebastian Andrzej Siewior
2021-11-12 7:31 ` Sebastian Andrzej Siewior
2021-11-12 22:10 ` Minchan Kim
2021-11-11 10:13 ` kernel test robot
2021-11-10 18:54 ` [PATCH 8/8] zsmalloc: replace get_cpu_var with local_lock Minchan Kim
2021-11-11 8:56 ` Sebastian Andrzej Siewior
2021-11-11 23:08 ` Minchan Kim
2021-11-15 3:56 ` Davidlohr Bueso [this message]
2021-11-15 7:27 ` 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=20211115035647.oh3wf6avptlo565k@offworld \
--to=dave@stgolabs.net \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.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