linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	linux-ide <linux-ide@vger.kernel.org>,
	Jens Axboe <jaxboe@fusionio.com>, Jeff Garzik <jgarzik@pobox.com>,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH 1/2]block: optimize non-queueable flush request drive
Date: Sat, 23 Apr 2011 01:32:04 +0200	[thread overview]
Message-ID: <20110422233204.GB1576@mtj.dyndns.org> (raw)
In-Reply-To: <1303202686.3981.216.camel@sli10-conroe>

Hello, Shaohua.

> +	list_splice_init(&q->flush_queue[q->flush_running_idx], &proceed_list);
> +	/*
> +	 * If queue doesn't support queueable flush request, we can push the
> +	 * pending requests to the next stage too. For such queue, there are no
> +	 * normal requests running when flush request is running, so this still
> +	 * guarantees the correctness.
> +	 */
> +	if (!blk_queue_flush_queueable(q))
> +		list_splice_tail_init(&q->flush_queue[q->flush_pending_idx],
> +			&proceed_list);

I can't see how this is safe.  Request completion is decoupled from
issue.  What prevents low level driver from take in other requests
before control hits here?  And even if that holds for the current
implementation, that's hardly something which can be guaranteed from
!flush_queueable.  Am I missing something?

This kind of micro optimization is gonna bring very painful bugs which
are extremely difficult to reproduce and track down.  It scares the
hell out of me.  It's gonna silently skip flushes where it shouldn't.

If you wanna optimize this case, a much better way would be
implementing back-to-back flush optimization properly such that when
block layer detects two flushes back-to-back and _KNOWS_ that no
request has been issued inbetween, the second one is handled as noop.
Mark the queue clean on flush, dirty on any other request and if the
queue is clean all flushes can be completed immediately on issue which
would also allow us to avoid the whole queue at the front or back
issue without bothering low level drivers at all.

Thanks.

-- 
tejun

  reply	other threads:[~2011-04-22 23:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-19  8:44 [PATCH 1/2]block: optimize non-queueable flush request drive Shaohua Li
2011-04-22 23:32 ` Tejun Heo [this message]
2011-04-25  1:33   ` Shaohua Li
2011-04-25  8:58     ` Tejun Heo
2011-04-25  9:13       ` Tejun Heo
2011-04-26  0:46         ` Shaohua Li
2011-04-26 10:48           ` Tejun Heo
2011-04-28  7:50             ` Shaohua Li
2011-04-30 14:37               ` Tejun Heo
2011-05-03  6:44                 ` Shaohua Li
2011-05-03  8:23                   ` Tejun Heo
2011-05-04  6:20                     ` Shaohua Li
2011-04-26  0:42       ` Shaohua Li
2011-04-26 10:40         ` Tejun Heo

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=20110422233204.GB1576@mtj.dyndns.org \
    --to=htejun@gmail.com \
    --cc=hch@infradead.org \
    --cc=jaxboe@fusionio.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaohua.li@intel.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;
as well as URLs for NNTP newsgroup(s).