@@ -775,7 +775,7 @@ void vhost_no_notify(struct vhost_virtqueue *vq)
int vhost_init(void)
{
- vhost_workqueue = create_workqueue("vhost");
+ vhost_workqueue = create_singlethread_workqueue("vhost");
if (!vhost_workqueue)
return -ENOMEM;
return 0;
@@ -106,10 +106,14 @@ static void handle_tx(struct vhost_net *net)
.msg_flags = MSG_DONTWAIT,
};
size_t len, total_len = 0;
- int err;
+ int err, wmem;
size_t hdr_size;
struct socket *sock = rcu_dereference(vq->private_data);
- if (!sock || !sock_writeable(sock->sk))
+ if (!sock)
+ return;
+
+ wmem = atomic_read(&sock->sk->sk_wmem_alloc);
+ if (wmem >= sock->sk->sk_sndbuf)
return;
use_mm(net->dev.mm);