From patchwork Mon Oct 26 20:05:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 55963 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9QK7fQ4008391 for ; Mon, 26 Oct 2009 20:07:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756104AbZJZUHe (ORCPT ); Mon, 26 Oct 2009 16:07:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756004AbZJZUHe (ORCPT ); Mon, 26 Oct 2009 16:07:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16117 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755992AbZJZUHd (ORCPT ); Mon, 26 Oct 2009 16:07:33 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9QK7ZO2025440; Mon, 26 Oct 2009 16:07:35 -0400 Received: from redhat.com (vpn-6-108.tlv.redhat.com [10.35.6.108]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9QK7U2N012261; Mon, 26 Oct 2009 16:07:31 -0400 Date: Mon, 26 Oct 2009 22:05:13 +0200 From: "Michael S. Tsirkin" To: Shirley Ma Cc: Sridhar Samudrala , Shirley Ma , David Stevens , kvm@vger.kernel.org, sri@linux.vnet.ibm.com, mashirle@linux.vnet.ibm.com Subject: Re: vhost-net patches Message-ID: <20091026200513.GA26623@redhat.com> References: <20091022123456.GA6682@redhat.com> <20091022131332.GB6961@redhat.com> <1256232224.6601.17.camel@localhost.localdomain> <20091022174344.GA10821@redhat.com> <1256234420.27706.5.camel@w-sridhar.beaverton.ibm.com> <20091023110438.GA20229@redhat.com> <1256310168.4443.2.camel@localhost.localdomain> <1256310765.4443.4.camel@localhost.localdomain> <1256315020.4443.12.camel@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1256315020.4443.12.camel@localhost.localdomain> User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 30708c6..67bfc08 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -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; diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index a140dad..49026bb 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -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);