Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1346193ybf; Sun, 1 Mar 2020 07:09:48 -0800 (PST) X-Google-Smtp-Source: APXvYqzzqsKZLuSxcXHPdh+fabCgz7Qn1j+35JDWu72zekieWZ0ocmOUnc3/LdExgKoldCqOl9FQ X-Received: by 2002:a05:6830:1101:: with SMTP id w1mr9963684otq.202.1583075387938; Sun, 01 Mar 2020 07:09:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583075387; cv=none; d=google.com; s=arc-20160816; b=Lg19Uh4xXCqHEhlKhxpjo+ngJFUYXH0u+OXWPPlYuhC7xB9ZHf+AYZzNPM6pwwmyWR lRUNtQuVTtygXkKlvy8Sy1OPkqf5tLPZ3W+fLd1mWC2qUbkK6S7bCJfWEMD2YlVnTO5i yKi0oRZyZiXGDxtKjojRzU80tz4/6rNE/f1M6CUuxKCHoC3YXcTn7s+OM7iLKIcdJEIv MiEVkuuLhVHhyGvo9yoq3YFH60R4trQOto4cSoDaYA7J3JlDS7xCTEHQH4fIV0M4LoEe 3BP5OWaZsA/yvup329GVcREuUXvnpHQcc3bQY56LF2hwOMaXywDYaOvq4DAFQE0VyP+S G39Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=tP/gSD5+hGF4kSUuyf0IMX8qY92n4AKk+ODYK3Rp4Dc=; b=uIaIqrNzb+Ui665elwt0T4Lgs7MiC5ZO7rx9lfA9PSa8ZzUsbvJuhRnnyAFAiW3B17 VXp8s5rQIii00wGiETSC0p83lTKX1AGeb1f7yEsXn3WZFx/uqNIHKKVpZan/WkMnQPxJ K1BY5Tf3k3yd7L+EBnXCWQTz4YA1bwktqAoH3IlRcePEphRBO0FTsMGRJpbuEiq03pKN WOKxQ2JY2/bMlEtLh5biMHAQNCPjbB6jTVZhekMQEjh5SUOq/qFez2Qe1G0tiTkPi6jG RLoW8HlNFc0UbKNzRmuJiWZrNwlb3vkP5sYPOSqH6uAkiD6FMXi3iwg2ePGEohIAPKO/ s8DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bZ59e6zO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si4497380oic.77.2020.03.01.07.09.35; Sun, 01 Mar 2020 07:09:47 -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; dkim=pass header.i=@kernel.org header.s=default header.b=bZ59e6zO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726366AbgCAPJZ (ORCPT + 99 others); Sun, 1 Mar 2020 10:09:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:58742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbgCAPJZ (ORCPT ); Sun, 1 Mar 2020 10:09:25 -0500 Received: from localhost (unknown [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00582214DB; Sun, 1 Mar 2020 15:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583075364; bh=L1d+AItbkkBXszkIwnSetgpZqP66VqdmSi0YX0Mk4EY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bZ59e6zO12/gehlMba0wC1AqoYskJYZ31aUz4qLL0ZrKxlDM8sc/4RI3soeWvuW6p 8e7qZxnQ0j/KSyqYcHl131c+J+qPMNcBVi9Rmf00PcoQCIc6z4VBPdhRk3Yv0deJBj z7JsJOlgYSYYeEDeSQVfhNcc3svn+CQ9EoEtivds= Date: Sun, 1 Mar 2020 16:09:13 +0100 From: Greg Kroah-Hartman To: Oscar Carter Cc: devel@driverdev.osuosl.org, Malcolm Priestley , linux-kernel@vger.kernel.org, Forest Bond , Gabriela Bittencourt , Colin Ian King Subject: Re: [PATCH] staging: vt6656: Declare a few variables as __read_mostly Message-ID: <20200301150913.GA1470815@kroah.com> References: <20200301112620.7892-1-oscar.carter@gmx.com> <20200301122514.GA1461917@kroah.com> <20200301131701.GA7487@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200301131701.GA7487@ubuntu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 01, 2020 at 02:17:01PM +0100, Oscar Carter wrote: > On Sun, Mar 01, 2020 at 01:25:14PM +0100, Greg Kroah-Hartman wrote: > > On Sun, Mar 01, 2020 at 12:26:20PM +0100, Oscar Carter wrote: > > > These include module parameters. > > > > > > Signed-off-by: Oscar Carter > > > --- > > > drivers/staging/vt6656/main_usb.c | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c > > > index 5e48b3ddb94c..701300202b21 100644 > > > --- a/drivers/staging/vt6656/main_usb.c > > > +++ b/drivers/staging/vt6656/main_usb.c > > > @@ -49,12 +49,12 @@ MODULE_LICENSE("GPL"); > > > MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); > > > > > > #define RX_DESC_DEF0 64 > > > -static int vnt_rx_buffers = RX_DESC_DEF0; > > > +static int __read_mostly vnt_rx_buffers = RX_DESC_DEF0; > > > module_param_named(rx_buffers, vnt_rx_buffers, int, 0644); > > > MODULE_PARM_DESC(rx_buffers, "Number of receive usb rx buffers"); > > > > > > #define TX_DESC_DEF0 64 > > > -static int vnt_tx_buffers = TX_DESC_DEF0; > > > +static int __read_mostly vnt_tx_buffers = TX_DESC_DEF0; > > > module_param_named(tx_buffers, vnt_tx_buffers, int, 0644); > > > MODULE_PARM_DESC(tx_buffers, "Number of receive usb tx buffers"); > > > > > > > Why? What does this help with? > > If we declare these variables __read_mostly we can improve the performance. If > these variables are read many more times than written, each core of a multicore > system can maintain a copy in a local cache and the time to access is less than > if they use the shared-cache. This is a USB driver, performance is always limited to the hardware, not the CPU location of variables. Please always benchmark things to see if it actually makes sense to make changes like this, before proposing them. thanks, greg k-h