Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247545

Re: [PATCH v2] block: flush queued bios when the process blocks

From Mike Snitzer <snitzer@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] block: flush queued bios when the process blocks
Date 2015-10-15 10:10 +0200
Message-ID <qjLLQ-sL-13@gated-at.bofh.it> (permalink)
References (5 earlier) <qgGSm-8hZ-11@gated-at.bofh.it> <qhkZr-76Q-7@gated-at.bofh.it> <qhkZs-76Q-29@gated-at.bofh.it> <qhLZE-3zF-1@gated-at.bofh.it> <qjHoR-2nM-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Oct 14 2015 at 11:27pm -0400,
Ming Lei <tom.leiming@gmail.com> wrote:

> On Sat, Oct 10, 2015 at 3:52 AM, Mike Snitzer <snitzer@redhat.com> wrote:
> >
> > Turns out that this change:
> > http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/commit/?h=wip&id=2639638c77768a86216be456c2764e32a2bcd841
> >
> > needed to be reverted with:
> > http://git.kernel.org/cgit/linux/kernel/git/snitzer/linux.git/commit/?h=wip&id=ad3ccd760da7c05b90775372f9b39dc2964086fe
> >
> > Because nested plugs caused generic_make_request()'s onstack bio_list to
> > go out of scope (blk_finish_plug() wouldn't actually flush the list
> > within generic_make_request because XFS already added an outermost
> > plug).
> 
> Looks you should have defined bio_list in plug as
> 
>                'struct bio_list bio_list'
> 
> instead of one pointer.

I realized that and fixed it (see commit ad3ccd760da7c05b90 referenced
above that does exactly that).  That wasn't the problem.

> >
> > But even after fixing that I then hit issues with these changes now
> > resulting in imperfect 'in_generic_make_request' accounting that happens
> > lazily once the outermost plug completes blk_finish_plug.  manifested as
> > dm-bufio.c:dm_bufio_prefetch's BUG_ON(dm_bufio_in_request()); hitting.
> 
> Looks this problem should be related with above 'bio_list' definition too.

No, as I explained it was due to the nested plug:

> >
> > Basically using the blk-core's onstack plugging isn't workable for
> > fixing this deadlock and we're back to having to seriously consider
> > this (with its additional hook in the scheduler)

To elaborate, for the code in DM (and other subsystems like bcache) that
rely on accurate accounting of whether we're actively _in_
generic_make_request: using plug to store/manage the bio_list isn't
workable because nested plugs change the lifetime of when the bio_list
is processed (as I implemented it -- which was to respect nested plugs).
I could've forced the issue by making the bio_list get processed
regardless of nesting but that would've made the onstack plugging much
more convoluted (duality between nested vs not just for bio_list's
benefit and for what gain?  Simply to avoid an extra conditional
immediately in the scheduler?  That conditional was still added anyway
but just as part of blk_needs_flush_plug so in the end there wasn't any
benefit!).

Hopefully my middle-of-the-night reply is coherent and helped to clarify
my position that (ab)using blk_plug for the bio_list management is
_really_ awkward. ;)

Thanks,
Mike
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [dm-devel] block: flush queued bios when the process blocks Mikulas Patocka <mpatocka@redhat.com> - 2015-10-06 20:20 +0200
  Re: block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-06 21:00 +0200
    [PATCH v2] block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-06 22:20 +0200
      Re: [PATCH v2] block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-06 22:30 +0200
      Re: [PATCH v2] block: flush queued bios when the process blocks Mikulas Patocka <mpatocka@redhat.com> - 2015-10-08 17:10 +0200
        Re: [PATCH v2] block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-08 17:10 +0200
          Re: [PATCH v2] block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-09 22:00 +0200
            Re: [PATCH v2] block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-09 22:00 +0200
              [PATCH v3 for-4.4] block: flush queued bios when process blocks to  avoid deadlock Mike Snitzer <snitzer@redhat.com> - 2015-10-14 22:50 +0200
                Re: [PATCH v3 for-4.4] block: flush queued bios when process blocks to avoid deadlock Jeff Moyer <jmoyer@redhat.com> - 2015-10-14 23:50 +0200
                Re: [PATCH v3 for-4.4] block: flush queued bios when process blocks  to avoid deadlock Ming Lei <tom.leiming@gmail.com> - 2015-10-17 18:10 +0200
            Re: [PATCH v2] block: flush queued bios when the process blocks Ming Lei <tom.leiming@gmail.com> - 2015-10-15 05:30 +0200
              Re: [PATCH v2] block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-15 10:10 +0200
                Re: [PATCH v2] block: flush queued bios when the process blocks Ming Lei <tom.leiming@gmail.com> - 2015-10-16 05:10 +0200
                Re: [PATCH v2] block: flush queued bios when the process blocks Mike Snitzer <snitzer@redhat.com> - 2015-10-16 17:30 +0200
                Re: [PATCH v2] block: flush queued bios when the process blocks Ming Lei <tom.leiming@gmail.com> - 2015-10-17 18:00 +0200
      Re: [PATCH v2] block: flush queued bios when the process blocks kbuild test robot <lkp@intel.com> - 2015-10-09 14:00 +0200

csiph-web