Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp60188imu; Sun, 4 Nov 2018 18:55:42 -0800 (PST) X-Google-Smtp-Source: AJdET5f8eQYSMB4QAUAdSddbgGcaedACuvCabO7T1Vg0BwPCI3ldHCw2C8gpbFzk27A/+WhjM4Jz X-Received: by 2002:a17:902:7408:: with SMTP id g8-v6mr19882051pll.168.1541386542151; Sun, 04 Nov 2018 18:55:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541386542; cv=none; d=google.com; s=arc-20160816; b=NG3yGRixPE+gtDLy2xXNaO0R85mqIN7CrkurxKmPGocp+rx/gc060PCxYMzEbpm2RO soZbPySmzQpqlobVoWLoC5zyPfCpzFWTLRgo1NKp6fb1hHMOjLlRPyiaYIV1dVYWuDCF 8ZWqtZlI0THcFTNkkxui1OnParAsHs+ZuJsr+nzFqPS7TH0S/upsqIk5BE0/LEtAQFQp RzuKsb3c9qxcji5VAo/1zdqBatSQaGy6z5j+E5WoNKaZFxRgMWmXiJpEWu/R5mpn/1LI P3C9WkhzBOIRwfFJ+aJhMmDk5yrLvFsUpGGhLkvXJu6Z5PFN+8vHCSD2oH+DLtzwxusj IbGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=BtHmZMDUKpWtpjnS3ZcXplg4FwacGHwt0iCfz9dROyM=; b=s01J1uVqpkJR4+4318ykmiSA6VfLiQFzel8/JErEbCb3umEp3kPj7SslxusRQvYyyA hjf/PwgBYzZmrw68xJW0U8xu3ZnlI8K5How4TY75QidS44kukaAZcKYOYtliJlbJVr1R RBeiusTQgR3gDhMkEEUZo7mZs6S1U2tadKO5eWspApwsQCcfxv5SNTOhapJURtNB8+6D 3i2EVpCUoEnFeCkXbv8IUXTLFH2VyLsOFhzVxtchw+61Mng8lAUf0uuSuD3FS3IIMzdy 8pTZ+JzVwgF9PKlgwXLNU5pbwKgGGF8IqEPmyGitsr1l389TiGLVIngjWRGyEWmE6MgL qgXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si45391399pfh.9.2018.11.04.18.55.26; Sun, 04 Nov 2018 18:55:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728953AbeKEMLN (ORCPT + 99 others); Mon, 5 Nov 2018 07:11:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38510 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbeKEMLN (ORCPT ); Mon, 5 Nov 2018 07:11:13 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CCA05C049587; Mon, 5 Nov 2018 02:53:49 +0000 (UTC) Received: from [10.72.12.184] (ovpn-12-184.pek2.redhat.com [10.72.12.184]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2FD825ED41; Mon, 5 Nov 2018 02:53:44 +0000 (UTC) Subject: Re: [PATCH 1/1] vhost: add per-vq worker thread To: Vitaly Mayatskikh , "Michael S . Tsirkin" Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181102160710.3741-1-v.mayatskih@gmail.com> <20181102160710.3741-2-v.mayatskih@gmail.com> From: Jason Wang Message-ID: Date: Mon, 5 Nov 2018 10:53:42 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181102160710.3741-2-v.mayatskih@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 05 Nov 2018 02:53:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/11/3 上午12:07, Vitaly Mayatskikh wrote: > + > +static int vhost_vq_poll_start(struct vhost_virtqueue *vq) > +{ > + if (!vq->worker) { > + vq->worker = kthread_create(vhost_vq_worker, vq, "vhost-%d/%i", > + vq->dev->pid, vq->index); > + if (IS_ERR(vq->worker)) { > + int ret = PTR_ERR(vq->worker); > + > + pr_err("%s: can't create vq worker: %d\n", __func__, > + ret); > + vq->worker = NULL; > + return ret; > + } > + } > + vhost_work_init(&vq->work, vhost_vq_poll_start_work); > + vhost_vq_work_queue(vq, &vq->work); > + return 0; > +} > + I wonder whether or not it's better to allow the device to specific the worker here instead of forcing a per vq worker model. Then we can keep the behavior of exist implementation and do optimization on top? Thanks