LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Ravi Krishnamurthy <Ravi_Krishnamurthy@adaptec.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Block driver freezes when using CFQ
Date: Tue, 31 Oct 2006 08:10:40 +0100
Message-ID: <20061031071040.GS14055@kernel.dk> (raw)
In-Reply-To: <4546D79E.40507@adaptec.com>

On Tue, Oct 31 2006, Ravi Krishnamurthy wrote:
> Jens Axboe wrote:
> >On Sat, Oct 28 2006, Ravi Krishnamurthy wrote:
> >>Hi all,
> >>
> >>   I have written a block driver that registers a virtual device and
> >>routes requests to appropriate real devices after some re-mapping of
> >>the requests. I am testing the driver by creating a filesystem on the
> >>virtual device and copying a large number of files on to it. The test
> >>causes the device to become unresponsive after some time. After some
> >>debugging, I noticed that this happens only if the I/O scheduler being
> >>used is CFQ. I have not had any trouble if the scheduler is noop,
> >>anticipatory or deadline. The problem occurs on all the kernels I have
> >>tested - 2.6.18-rc2, 2.6.18-rc4, 2.6.19-rc3.
> >>
> 
> 
> >
> >The io scheduler is not obligated to recall your request handling
> >function, _unless_ you have no pending io at the point where
> >elv_next_request() returns NULL but there are things pending. 
> >IOW, when you complete your requests you want to just recall your request 
> >handling
> >function. Just insert something ala:
> >
> >        if (elv_next_request(q))
> >                q->request_fn(q);
> >
> >when you are done completing requests.
> >
> >Does that fix it?
> 
> I haven't had a chance to test this fix. A workaround I had tried was to
> insert these lines at the end of the request function:
>        if (! elv_queue_empty(q))
>             blk_plug_device(q);
> 
> This worked for me. So I assume the fix you have suggested will surely
> work.

You don't want to do that. It is the duty of the plugger to unplug the
device again, and in your case that is probably deferred to the timer
auto-unplug. So don't involve plugging, it's a seperate thing. Just
leave the request function when elv_next_request(), and always recall it
when you are done completing requests.

> I am curious to know why the problem does not occur when I am using the
> anticipatory scheduler. Also, in the suggested fix, is it guaranteed that
> elv_next_request() will not return NULL as long as the elevator queue is
> not empty?

Perhaps it recalls ->request_fn() more often than it should. If you call

-- 
Jens Axboe


  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <454313C9.4010602@adaptec.com>
2006-10-30  8:22 ` [Fwd: Block driver freezes when using CFQ] Jens Axboe
2006-10-31  4:57   ` Block driver freezes when using CFQ Ravi Krishnamurthy
2006-10-31  7:10     ` Jens Axboe [this message]
2006-10-28  6:58 Ravi Krishnamurthy
2006-10-30  6:22 ` 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=20061031071040.GS14055@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=Ravi_Krishnamurthy@adaptec.com \
    --cc=linux-kernel@vger.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git