From: peterz@infradead.org
To: Oleg Nesterov <oleg@redhat.com>
Cc: Hou Tao <houtao1@huawei.com>, Ingo Molnar <mingo@redhat.com>,
Will Deacon <will@kernel.org>, Dennis Zhou <dennis@kernel.org>,
Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH] locking/percpu-rwsem: use this_cpu_{inc|dec}() for read_count
Date: Tue, 15 Sep 2020 17:51:50 +0200 [thread overview]
Message-ID: <20200915155150.GD2674@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200915153113.GA6881@redhat.com>
On Tue, Sep 15, 2020 at 05:31:14PM +0200, Oleg Nesterov wrote:
> > So yeah, fs/super totally abuses percpu_rwsem, and yes, using it from
> > IRQ context is totally out of spec. That said, we've (grudgingly)
> > accomodated them before.
>
> Yes, I didn't expect percpu_up_ can be called from IRQ :/
Yeah, me neither. That's well out of spec for a blocking primitive in
general.
> > This seems to be a fairly long standing issue, and certainly not unique
> > to ARM64 either (Power, and anyone else using asm-gemeric/percpu.h,
> > should be similarly affected I think). The issue seems to stem from
> > Oleg's original rewrite:
> >
> > a1fd3e24d8a4 ("percpu_rw_semaphore: reimplement to not block the readers unnecessarily")
>
> Not really... I think it was 70fe2f48152e ("aio: fix freeze protection of aio writes").
Ah, that came later? Fair enough, I'll change the Fixes line.
> And iiuc io_uring does the same.
Indeed, I just went through a bunch of the file_end_write() callers.
> > and is certainly an understandable mistake.
> >
> > I'm torn on what to do, using this_cpu over __this_cpu is going to
> > adversely affect code-gen (and possibly performance) for all the
> > percpu-rwsem users that are not quite so 'creative'.
>
> Yes, but what else can we do?
Well, I just talked about it with Will, there's a bunch of things we
could do, but they're all quite ugly.
My leading alternative was adding: percpu_down_read_irqsafe() /
percpu_up_read_irqsafe(), which use local_irq_save() instead of
preempt_disable().
But blergh.. Will also argued that by going with this patch, we'll get
an affected workload when someone reports a performance regression,
which I suppose is a bonus.
Anyway, I'll rewrite the Changelog and stuff it in locking/urgent.
next prev parent reply other threads:[~2020-09-15 16:31 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 14:07 [RFC PATCH] locking/percpu-rwsem: use this_cpu_{inc|dec}() for read_count Hou Tao
2020-09-15 15:06 ` peterz
2020-09-15 15:31 ` Oleg Nesterov
2020-09-15 15:51 ` peterz [this message]
2020-09-15 16:03 ` peterz
2020-09-15 16:11 ` Will Deacon
2020-09-15 18:11 ` peterz
2020-09-16 8:20 ` Will Deacon
2020-09-15 16:47 ` Oleg Nesterov
2020-09-16 12:32 ` Hou Tao
2020-09-16 12:51 ` peterz
2020-09-17 8:48 ` Will Deacon
2020-09-24 11:55 ` Hou Tao
2020-09-29 17:49 ` Will Deacon
2020-09-29 18:07 ` Ard Biesheuvel
2020-09-17 10:51 ` Boaz Harrosh
2020-09-17 12:01 ` Oleg Nesterov
2020-09-17 12:48 ` Matthew Wilcox
2020-09-17 13:22 ` peterz
2020-09-17 13:34 ` Oleg Nesterov
2020-09-17 13:46 ` Boaz Harrosh
2020-09-17 14:46 ` Christoph Hellwig
2020-09-18 9:07 ` Jan Kara
2020-09-18 10:01 ` peterz
2020-09-18 10:04 ` peterz
2020-09-18 10:07 ` peterz
2020-09-18 10:12 ` peterz
2020-09-18 10:48 ` Oleg Nesterov
2020-09-18 11:03 ` peterz
2020-09-18 13:09 ` Oleg Nesterov
2020-09-18 13:26 ` Jan Kara
2020-09-20 23:49 ` Dave Chinner
2020-09-18 8:36 ` [tip: locking/urgent] locking/percpu-rwsem: Use this_cpu_{inc,dec}() " tip-bot2 for Hou Tao
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=20200915155150.GD2674@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=cl@linux.com \
--cc=dennis@kernel.org \
--cc=houtao1@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=tj@kernel.org \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).