Re: [BIO] Bounce queue in bio_add_page

From: Jens Axboe
Date: Mon Nov 03 2003 - 07:29:56 EST

On Sat, Nov 01 2003, Herbert Xu wrote:
> On Sat, Nov 01, 2003 at 03:46:19PM +1100, herbert wrote:
> >
> > Currently bio_add_page will allow segments to be counted as merged
> > before they've been bounced. This can create bio's that exceed
> > limits set by the driver/hardware. This bug can be triggered on
> > HIGHMEM machines as well as ISA block devices such as AHA1542.
> >
> > Here is a hack that works around it by bouncing the queue before
> > recounting the segments.
> That patch chained bio's together which is prone to deadlock. I've
> modified __blk_queue_bounce to only allocate a new bio if it hasn't
> been bounced already. Unfortunately it has to allocate one with the
> maximum number of bvecs so it's even more of a hack.
> Hopefully someone else can come up with a better fix.

I think the best fix would be to simply not allow more than one page
that needs to be bounced to a bio. The problem is that the whole bio and
bio_vec allocations needs to be duplicated for highmem bouncing, and
that really doesn't thrill me. So a single mempool for bio, and single
entry bio_vec would be a lot leaner. I'll see if I can squeeze out a
prototype today.

I totally agree with your analysis of the problem, though.

Jens Axboe

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at