提交 e538ebaf 编写于 作者: R Rusty Russell

tools/virtio: make vringh_test use inbuf/outbuf.

As expected, the simplified accessors are faster.

for i in `seq 50`; do /usr/bin/time -f 'Wall time:%e' ./vringh_test --indirect --eventidx --parallel --fast-vringh; done 2>&1 | stats --trim-outliers:

Before:
	Using CPUS 0 and 3
	Guest: notified 0, pinged 39062-39063(39063)
	Host: notified 39062-39063(39063), pinged 0
	Wall time:1.760000-2.220000(1.789167)

After:
	Using CPUS 0 and 3
	Guest: notified 0, pinged 39037-39063(39062)
	Host: notified 39037-39063(39062), pinged 0
	Wall time:1.640000-1.810000(1.676875)
Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
上级 282edb36
...@@ -63,6 +63,16 @@ int virtqueue_add_sgs(struct virtqueue *vq, ...@@ -63,6 +63,16 @@ int virtqueue_add_sgs(struct virtqueue *vq,
void *data, void *data,
gfp_t gfp); gfp_t gfp);
int virtqueue_add_outbuf(struct virtqueue *vq,
struct scatterlist sg[], unsigned int num,
void *data,
gfp_t gfp);
int virtqueue_add_inbuf(struct virtqueue *vq,
struct scatterlist sg[], unsigned int num,
void *data,
gfp_t gfp);
void virtqueue_kick(struct virtqueue *vq); void virtqueue_kick(struct virtqueue *vq);
void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len); void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
......
...@@ -369,11 +369,11 @@ static int parallel_test(unsigned long features, ...@@ -369,11 +369,11 @@ static int parallel_test(unsigned long features,
* user addr */ * user addr */
__kmalloc_fake = indirects + (xfers % RINGSIZE) * 4; __kmalloc_fake = indirects + (xfers % RINGSIZE) * 4;
if (output) if (output)
err = virtqueue_add_buf(vq, sg, num_sg, 0, dbuf, err = virtqueue_add_outbuf(vq, sg, num_sg, dbuf,
GFP_KERNEL); GFP_KERNEL);
else else
err = virtqueue_add_buf(vq, sg, 0, num_sg, dbuf, err = virtqueue_add_inbuf(vq, sg, num_sg,
GFP_KERNEL); dbuf, GFP_KERNEL);
if (err == -ENOSPC) { if (err == -ENOSPC) {
if (!virtqueue_enable_cb_delayed(vq)) if (!virtqueue_enable_cb_delayed(vq))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册