Re: [PATCH 02/16] virtio_ring: virtqueue_add_sgs, to add multiple sgs.

From: Rusty Russell
Date: Wed Feb 27 2013 - 02:30:15 EST

Paolo Bonzini <pbonzini@xxxxxxxxxx> writes:
> Il 24/02/2013 23:12, Michael S. Tsirkin ha scritto:
>> On Tue, Feb 19, 2013 at 06:26:20PM +1030, Rusty Russell wrote:
>>> virtio_scsi can really use this, to avoid the current hack of copying
>>> the whole sg array. Some other things get slightly neater, too.
>>> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
>> Hmm, this makes add_buf a bit slower. virtio_test results
>> (I'll send a patch to update the test shortly):
>> Before:
>> 0.09user 0.01system 0:00.12elapsed 91%CPU (0avgtext+0avgdata 480maxresident)k
>> 0inputs+0outputs (0major+145minor)pagefaults 0swaps
>> After:
>> 0.11user 0.01system 0:00.13elapsed 90%CPU (0avgtext+0avgdata 480maxresident)k
>> 0inputs+0outputs (0major+145minor)pagefaults 0swaps
> Not unexpected at all... :(
> Some of it can be recovered, but if it's 20% I doubt all of it. So my
> patches were not premature optimization; you really can take just two
> among speed, flexibility, and having a nice API.

The error bars on this are far too large to say "20%".

Here are my numbers, using 50 runs of:
time tools/virtio/vringh_test --indirect --eventidx --parallel and
stats --trim-outliers:

Baseline (before add_sgs):

After add_sgs:

After simplifying add_buf a little:

After inlining virtqueue_add/vring_add_indirect:

After passing in iteration functions (chained vs unchained):

After removing the now-unnecessary chain-cleaning in add_buf:

Any questions?
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