2006-09-06 13:38:54

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH 11/21] nbd: limit blk_queue

Limit each request to 1 page, so that the request throttling also limits the
number of in-flight pages and force the IO scheduler to NOOP as anything else
doesn't make sense anyway.

(Pavel, I will analyse those !NOOP deadlocks I got, I'm just re-posting so
people can comment on the rest)

Signed-off-by: Peter Zijlstra <[email protected]>
Signed-off-by: Daniel Phillips <[email protected]>
CC: Pavel Machek <[email protected]>
---
drivers/block/nbd.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/block/nbd.c
===================================================================
--- linux-2.6.orig/drivers/block/nbd.c
+++ linux-2.6/drivers/block/nbd.c
@@ -628,11 +636,16 @@ static int __init nbd_init(void)
* every gendisk to have its very own request_queue struct.
* These structs are big so we dynamically allocate them.
*/
- disk->queue = blk_init_queue(do_nbd_request, &nbd_lock);
+ disk->queue = blk_init_queue_node_elv(do_nbd_request,
+ &nbd_lock, -1, "noop");
if (!disk->queue) {
put_disk(disk);
goto out;
}
+ blk_queue_pin_elevator(disk->queue);
+ blk_queue_max_segment_size(disk->queue, PAGE_SIZE);
+ blk_queue_max_hw_segments(disk->queue, 1);
+ blk_queue_max_phys_segments(disk->queue, 1);
}

if (register_blkdev(NBD_MAJOR, "nbd")) {

--


2006-09-06 15:17:21

by Erik Mouw

[permalink] [raw]
Subject: Re: [PATCH 11/21] nbd: limit blk_queue

On Wed, Sep 06, 2006 at 03:16:41PM +0200, Peter Zijlstra wrote:
> - disk->queue = blk_init_queue(do_nbd_request, &nbd_lock);
> + disk->queue = blk_init_queue_node_elv(do_nbd_request,
> + &nbd_lock, -1, "noop");

So what happens if the noop scheduler isn't compiled into the kernel?


Erik

--
+-- Erik Mouw -- http://www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands

2006-09-06 17:41:44

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH 11/21] nbd: limit blk_queue

On Wed, Sep 06 2006, Erik Mouw wrote:
> On Wed, Sep 06, 2006 at 03:16:41PM +0200, Peter Zijlstra wrote:
> > - disk->queue = blk_init_queue(do_nbd_request, &nbd_lock);
> > + disk->queue = blk_init_queue_node_elv(do_nbd_request,
> > + &nbd_lock, -1, "noop");
>
> So what happens if the noop scheduler isn't compiled into the kernel?

You can't de-select noop, so that cannot happen. But the point is valid
for other choices of io schedulers, which is another reason why this
_elv api addition is a bad idea.

--
Jens Axboe