]> www.infradead.org Git - users/dwmw2/linux.git/commit
vhost: introduce vhost_exceeds_weight()
authorJason Wang <jasowang@redhat.com>
Fri, 17 May 2019 04:29:49 +0000 (00:29 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Aug 2019 11:39:24 +0000 (12:39 +0100)
commit2a59b04bcdb2f009906982e711b20bcd40fd253f
tree146e86184adb85018f9a669e7010c1f2e02d8d8c
parente22aecb0e563f5e9705dcfb55231fd079041ff1c
vhost: introduce vhost_exceeds_weight()

commit e82b9b0727ff6d665fff2d326162b460dded554d upstream.

We used to have vhost_exceeds_weight() for vhost-net to:

- prevent vhost kthread from hogging the cpu
- balance the time spent between TX and RX

This function could be useful for vsock and scsi as well. So move it
to vhost.c. Device must specify a weight which counts the number of
requests, or it can also specific a byte_weight which counts the
number of bytes that has been processed.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
[bwh: Backported to 3.16:
 - Drop changes to vhost_vsock
 - In vhost_net, both Tx modes are handled in one loop in handle_tx()
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/vhost/net.c
drivers/vhost/scsi.c
drivers/vhost/vhost.c
drivers/vhost/vhost.h