From: Kent Overstreet <kmo@daterainc.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, Mike Snitzer <snitzer@redhat.com>,
dm-devel@redhat.com, linux-kernel@vger.kernel.org,
Alasdair Kergon <agk@redhat.com>
Subject: Re: [PATCH for-next] dm: fix missing bi_remaining accounting
Date: Mon, 4 Nov 2013 12:12:04 -0800 [thread overview]
Message-ID: <20131104201204.GA27733@kmo> (raw)
In-Reply-To: <alpine.LRH.2.02.1311041003400.4548@file01.intranet.prod.int.rdu2.redhat.com>
On Mon, Nov 04, 2013 at 10:06:00AM -0500, Mikulas Patocka wrote:
>
>
> On Fri, 1 Nov 2013, Jens Axboe wrote:
>
> > On 11/01/2013 07:59 AM, Mike Snitzer wrote:
> > > Add the missing bi_remaining increment, required by the block layer's
> > > new bio-chaining code, to both the verity and old snapshot DM targets.
> > >
> > > Otherwise users will hit the bi_remaining <= 0 BUG_ON in bio_endio().
> >
> > Thanks Mike, added to the mix.
> >
> > --
> > Jens Axboe
>
> Hi
>
> This improves a little bit on the previous patch, by replacing costly
> atomic_inc with cheap atomic_set.
IMO, this is a bad idea; the behaviour with this patch does _not_ match the
naming of bio_endio_nodec(), and the performance difference should be well in
the noise anyways because we're touching a cacheline we already have in cache
and won't be contended.
The fact that it's currently safe is accidental, I could see this easily
tripping people up and being a pain in the ass to debug in the future.
>
>
> From: Mikulas Patocka <mpatocka@redhat.com>
>
> dm: change atomic_inc to atomic_set(1)
>
> There are places in dm where we save bi_endio and bi_private, set them to
> target's routine, submit the bio, from the target's bi_endio routine we
> restore bi_endio and bi_private and end the bio with bi_endio.
>
> This causes underflow of bi_remaining, so we must restore bi_remaining
> before ending the bio from the target bi_endio routine.
>
> The code uses atomic_inc for restoration of bi_remaining. This patch
> changes it to atomic_set(1) to avoid an interlocked instruction. In the
> target's bi_endio routine we are sure that bi_remaining is zero
> (otherwise, the bi_endio routine wouldn't be called) and there are no
> concurrent users of the bio, so we can replace atomic_inc with
> atomic_set(1).
prev parent reply other threads:[~2013-11-04 20:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-01 13:59 [PATCH for-next] dm: fix missing bi_remaining accounting Mike Snitzer
2013-11-01 15:03 ` Jens Axboe
2013-11-01 15:43 ` stec skd block driver needs updating for immutable biovec Mike Snitzer
2013-11-01 15:50 ` Christoph Hellwig
2013-11-01 16:02 ` Jens Axboe
2013-11-01 16:28 ` Mike Snitzer
2013-11-01 16:34 ` Jens Axboe
2013-11-01 17:46 ` Mike Snitzer
2013-11-04 11:25 ` Bartlomiej Zolnierkiewicz
2013-11-04 15:06 ` [PATCH for-next] dm: fix missing bi_remaining accounting Mikulas Patocka
2013-11-04 15:20 ` Mike Snitzer
2013-11-04 15:25 ` Mikulas Patocka
2013-11-04 16:04 ` Mike Snitzer
2013-11-04 17:49 ` Mikulas Patocka
2013-11-05 0:56 ` Mike Snitzer
2013-11-04 20:12 ` Kent Overstreet [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=20131104201204.GA27733@kmo \
--to=kmo@daterainc.com \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@redhat.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 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.