From: Thomas Gleixner <tglx@linutronix.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Kent Overstreet <kmo@daterainc.com>,
Ben Hutchings <ben@decadent.org.uk>,
linux-kernel@vger.kernel.org,
Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Subject: Re: PREEMPT_RT vs bcache
Date: Thu, 12 Sep 2013 17:01:34 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1309121653110.4089@ionos.tec.linutronix.de> (raw)
In-Reply-To: <20130808121154.GA5180@infradead.org>
On Thu, 8 Aug 2013, Christoph Hellwig wrote:
> On Thu, Aug 08, 2013 at 12:43:26AM -0700, Kent Overstreet wrote:
> > I seem to recall from looking at the logs that you just removed them
> > because all the old users could be and were converted to something
> > saner, for what they were doing (using them as completions, I want to
> > say?)
>
> We explicitly converted them away so that we could kill it. This was
> a joint project with Thomas.
>
> > Bcache isn't using the rw sem as a completion though, it really is a
> > read/write lock that protects a specific data structure, and where
> > we're taking a read lock for the duration of write IOs - and since bios
> > are asynchronous, that's why we need the non_owner() bit.
>
> Part of this commit was to make the rw_semaphore behaviour similar to
> plain mutex, that is making sure there is exactly one owner and not
> different processes locking/unlocking it. This is useful for PI (that's
> why the rt folks care), lock debugging and kinds of other use cases.
Right. We had to implement an anon_rw_semaphore version, which caused
more headache than it was worth the trouble.
The solution for one of the non owner use cases was something like the
below:
read_lock(x->lock);
atomic_inc(x->io_active);
launch_io();
read_unlock(x->lock);
On the writer side:
write_lock(x->lock);
while (atomic_read(x->io_active) {
write_unlock(x->lock);
wait_event(x->wait_for_io, !atomic_read(x->io_active));
write_lock(x->io_active);
}
....
On the io side:
complete_io()
if (atomic_dec_and_test(x->io_active) &&
waitqueue_active(x->wait_for_io))
wake_up(x->wait_for_io);
That would fit into the bcache use case afacit.
Thanks,
tglx
prev parent reply other threads:[~2013-09-12 15:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 20:28 Ben Hutchings
2013-08-07 20:53 ` Kent Overstreet
2013-08-07 21:08 ` Ben Hutchings
2013-08-07 21:09 ` Kent Overstreet
2013-08-07 21:12 ` Uwe Kleine-König
2013-08-08 7:26 ` Christoph Hellwig
2013-08-08 7:43 ` Kent Overstreet
2013-08-08 12:11 ` Christoph Hellwig
2013-09-12 15:01 ` Thomas Gleixner [this message]
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=alpine.DEB.2.02.1309121653110.4089@ionos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=ben@decadent.org.uk \
--cc=hch@infradead.org \
--cc=kmo@daterainc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®