Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3190753pxu; Tue, 8 Dec 2020 06:01:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+LiIcWS9OPANoGjRj2Ib+RKm9RJ9+UnDPRsPOhwdW8mzxTj9wgWBb7hrIZKqD2caugrSy X-Received: by 2002:a17:907:3f9e:: with SMTP id hr30mr23249079ejc.258.1607436076203; Tue, 08 Dec 2020 06:01:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607436076; cv=none; d=google.com; s=arc-20160816; b=V6fOcFRclZ+A7IloKMbQaMbKEWtV5UTMwMOpRbdV75jurb7JW8CaNI7+Hev2eRqGHZ W/YtwP8uUKuy/yBv/HSRZBN645aJH8radDcUnf2h8Zf7gNNFA/e10F7RxPNJz8g+4r+n 2g4ImBQqhBXlxHTiVSGkFmAiK6OdGBpViBG2DqAa4Fb6kcx2tYipouoZJOe9i268cKc4 EPNQqtUq22gx27YHgGfDBhv1/KsOQCMD4QHo2A8OUyGqKLiNm43USG2ZbhT9Urj7Uv3Y ebdQoZKw1ccHY5Z8s5X9Noi/3ZXFrvadm05SNFib+m1FidxKuwasENACcboNap9Sl7Yv ytlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XdwZVmp6074Z98H6zQEtlKhAw+DWLjOXe9vwluABFMA=; b=QrWvftDxbnStQDOUDwe4k6XFR2uX/FXDAijngSH371eCX8N+mLyOkyaWLO70TfTrzr A6lPqKEcdULoe5HZCk1WvO1QBAWW2KFcsSyap0xDyQ1LpBVWOA6iR96LcsQFRwol8QLa gEDJVbv//fXP9YpBIAkA4gUDAPaG8wPhUcL43XU7KYkbd9Xl4xujz2WbRxbaOAbjI5JN 9QfVomixgiE7opg/118np2hdcaoAAnSlLPFNQHSJa260812/JMBanegj3IU+I7Dduftk AFl9ohM4A+o5ketcccF7MZsdU0ruH1rBHCoWHR0EPUVh1uX7MSSREfCCL+eNZFYPbaan GSxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dXXwsTO0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si8296875ejg.677.2020.12.08.06.00.51; Tue, 08 Dec 2020 06:01:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dXXwsTO0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729629AbgLHN4j (ORCPT + 99 others); Tue, 8 Dec 2020 08:56:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43810 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729600AbgLHN4i (ORCPT ); Tue, 8 Dec 2020 08:56:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607435712; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XdwZVmp6074Z98H6zQEtlKhAw+DWLjOXe9vwluABFMA=; b=dXXwsTO00hrRO4/xBxQ4Th82LRkgDH6pd2VqlWQjyzdptHyt3Rno9HIJp1/TSmcJRm6sAm qljg/c/XBBNjQJ6ZuZAcAzcNAH1WKNLP5X14oy4inbHssFhQTu+m7VyiZwact89gEErxJO Zu+WasfWaf6xOCAfPUpIKpiOo4yXPWo= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-UTOz2rUhMYCD05NwDfnp0A-1; Tue, 08 Dec 2020 08:55:11 -0500 X-MC-Unique: UTOz2rUhMYCD05NwDfnp0A-1 Received: by mail-wr1-f72.google.com with SMTP id m2so6223623wro.1 for ; Tue, 08 Dec 2020 05:55:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XdwZVmp6074Z98H6zQEtlKhAw+DWLjOXe9vwluABFMA=; b=b601vaccOjJ0CwbkiAy6L82ekHmlKJe+ow6hPvWdwpZduo6OkWwtVrdkNZnVCw2Aj2 jbhRjRGCDl2iQbIlSPF+4rMlppw9FpNUluBSjC8f9IyqRkBYyvHuGu3Hr90N8W6XSDtX IHjh0qWLes/R+k0qdxSstijbtwgH502o7F9JLCa0M8VHrvKFCiE/RoEkutlDi/9QpqfB FAoAPNHuRG/97Y7sSB08dW4z3qjJMeTIXPDHRUwTmjDIz8959SmsVlI3+ZQbqt13xlq3 F8sXMYPwh0sLy9A5JTZsBNZ/BHYzSBFGMvdpYqvBogwRaV3jcpdFEaH9X7jAJGOGsSl6 fyrQ== X-Gm-Message-State: AOAM532s92crAjIbB9WCMN9ORZNrTkzjpazx/BVqSbXufJ5rYkdta0x/ mYVq96lcOPzeAGMe5l2YnmN0SOATVVOE3lfLGsXGCnqcrNjPwsvXC9icJUg++C5llMb6DcGMpI3 +Eb/5IKjwNYs7eVfRiSLVaztW X-Received: by 2002:a05:600c:211:: with SMTP id 17mr3995061wmi.84.1607435709589; Tue, 08 Dec 2020 05:55:09 -0800 (PST) X-Received: by 2002:a05:600c:211:: with SMTP id 17mr3995051wmi.84.1607435709452; Tue, 08 Dec 2020 05:55:09 -0800 (PST) Received: from redhat.com (bzq-79-176-44-197.red.bezeqint.net. [79.176.44.197]) by smtp.gmail.com with ESMTPSA id v189sm3702487wmg.14.2020.12.08.05.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 05:55:08 -0800 (PST) Date: Tue, 8 Dec 2020 08:55:06 -0500 From: "Michael S. Tsirkin" To: liush Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] virtio: replace constant parameter '1' with num Message-ID: <20201208085423-mutt-send-email-mst@kernel.org> References: <1607428671-4802-1-git-send-email-liush@allwinnertech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1607428671-4802-1-git-send-email-liush@allwinnertech.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 08, 2020 at 07:57:51PM +0800, liush wrote: > 'num' can represent the value of out_sgs(in_sags), no need to pass > in constant parameters in 'virtqueue_add'. > > Signed-off-by: liush Point being? A constant is likely easier for the compiler to optimize ... > --- > drivers/virtio/virtio_ring.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > index becc776..7583f8b 100644 > --- a/drivers/virtio/virtio_ring.c > +++ b/drivers/virtio/virtio_ring.c > @@ -1760,7 +1760,7 @@ int virtqueue_add_outbuf(struct virtqueue *vq, > void *data, > gfp_t gfp) > { > - return virtqueue_add(vq, &sg, num, 1, 0, data, NULL, gfp); > + return virtqueue_add(vq, &sg, num, num, 0, data, NULL, gfp); > } > EXPORT_SYMBOL_GPL(virtqueue_add_outbuf); > > @@ -1782,7 +1782,7 @@ int virtqueue_add_inbuf(struct virtqueue *vq, > void *data, > gfp_t gfp) > { > - return virtqueue_add(vq, &sg, num, 0, 1, data, NULL, gfp); > + return virtqueue_add(vq, &sg, num, 0, num, data, NULL, gfp); > } > EXPORT_SYMBOL_GPL(virtqueue_add_inbuf); > > -- > 2.7.4