Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp355862imm; Wed, 29 Aug 2018 01:35:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZV94ERDI1/OIjqJCn7w19CL9NAAGiBgZwo7ZKK4u455wAARW5M+m4ZU6e5i82zd1Dms/nQ X-Received: by 2002:a62:6283:: with SMTP id w125-v6mr4958742pfb.108.1535531734620; Wed, 29 Aug 2018 01:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535531734; cv=none; d=google.com; s=arc-20160816; b=NgXDJLdXtcNeskyLDdw/mQ+jBtJ1/1WH65ig/m8uAKvx2xk8YC2SXQUqjNthojrIOb WcS7CX/cH8apNdM6BS5LozPOqViZivPbJlftJSwxnok30LBTBEZnZnspTcXmiY+5JzWe hi+59/luHWQnYslVSF/Mq9Qz6xqDf8PJEbAhLtLanrI+nhHHY4qnM2NzbPIjFyKaOJS0 MUlp0AeRu56pO0AJC0jfmsjIMsIkv+JiErPL3UlyfKO0NEICu9GvkFxTkgQ2nn3Xq+cS Cdn5ZqZdLMpws76sbtHse0IRJTheUK9Mm1AGUk106xmJwJraSWUVrVoiPfRgw0nhw91K 0jqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=ssSYEkoUjeRD2907CRxsnGJWrPIgq8vvZI3n7lRvDkk=; b=cE40bJ//w73GUKfIQg9RaqW+zQboPYZ2cezp5toYBUG1CJHlECYimfSLKgwmm3ix9z dDu8u4qPxOGngQ3kGxo3AULZ15p9p45hacJxlLItp9pUomyl3+onO9GHaA45AmYAkPVx 9KrEgckQZAozNUkYYPwUUUQ+xOClaZgWDKHsT2Eh6Y4QRlspigoGegtOFrP/I7B7zh/9 j7uUwlNAW4DD6p+e//Iq8wbFB9eI1vkbgbKc0IzVGH7W2L4FwNsZvvR0s1zYFK1aPMjQ ucUB3TmtmCaW6V/lhHDMIzdzhPLUz80fkouPK3zTITRAkFFsRM1WemBtILV3njN9f5YU XZlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=nuSZWYmU; 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 l63-v6si3202520pfg.326.2018.08.29.01.35.19; Wed, 29 Aug 2018 01:35:34 -0700 (PDT) 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=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=nuSZWYmU; 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 S1728160AbeH2M3T (ORCPT + 99 others); Wed, 29 Aug 2018 08:29:19 -0400 Received: from mail-eopbgr720041.outbound.protection.outlook.com ([40.107.72.41]:13100 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727133AbeH2M3T (ORCPT ); Wed, 29 Aug 2018 08:29:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ssSYEkoUjeRD2907CRxsnGJWrPIgq8vvZI3n7lRvDkk=; b=nuSZWYmU7xerEJTMJbjWqIapm4Zc5NDd+Pg5AeY84pcMrV/izrnxOAyOOMcPai4tO39CCW7GKNiPOxMhRWTDg3LGVAIdW9vI9/2Jy3yE7wDd8Su5Ahf9mXCmnTsq0DXXXA+v951sv6/IZLQK+IIp1JST1fo5XPtXWwui71y2NhA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by BLUPR0301MB1571.namprd03.prod.outlook.com (2a01:111:e400:52a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1101.14; Wed, 29 Aug 2018 08:33:26 +0000 Date: Wed, 29 Aug 2018 16:30:21 +0800 From: Jisheng Zhang To: , "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Gregory CLEMENT , linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/5] net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe Message-ID: <20180829163021.70ce99ab@xhacker.debian> In-Reply-To: <20180829162456.2bd69796@xhacker.debian> References: <20180829162456.2bd69796@xhacker.debian> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: TYAPR04CA0004.apcprd04.prod.outlook.com (2603:1096:404:15::16) To BLUPR0301MB1571.namprd03.prod.outlook.com (2a01:111:e400:52a9::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c07545e-34ab-4c17-3c45-08d60d8a18db X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BLUPR0301MB1571; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0301MB1571;3:JALAq0nJFJmsx+X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z5JPZ/rd/N/HhKwopZZhwkD4jIb+mrqCyH19bp7Rsw3VDOeaxgM/9qx9s/T/+rQa7ldogGk3/AuX3XM+s0bkFYfSWvXDIpmJ0TrdVF7DDgYwZq02j15EvSszGdIfLOMkEdJYJDWmK+nuZ6p9dcab3flaKZT3ZZQD/zrdrHqhszS8WB9wEkIGlF0+9s0rcCIrmvCTR5M7j8YR4YHI7j3v/exK+Km8sNlIhYr6qo+bFReC30DDJrGQ0Ysh5OemUunHCX7C6v3Qn1L3u/dvI9wnsufHO/y/JMpYCT13tTDh/AYUO2m2URe+yF/vy7de7hp9p+oAEm3J7e;4:TOZFexnI+z2Q2yhNlQtfnAcigjfK8GO0XkWSPKYJsWPi+n3acwN/t8j148s+d2ofmqLTG4+JXYQUwFiY0JptbqFym45OgJ9gVWdM+F2QnA3olGeCtTGWV7qIXtRg2mVn7HD/vviHoLCELijFflYKeTY9qiUWdfrnxqM+FZW+ywCDu6qpsgWfJTmvSydnGtZGsS2IbWJV9jyZ9CZmxJV9vc1zTjVApQIomU1jpiCow9snf5onGw0cK0MzxADLvUmW4iGJ8LzvdPNHDTTIkSBBNQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699016);SRVR:BLUPR0301MB1571;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1571; X-Forefront-PRVS: 077929D941 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(366004)(136003)(39860400002)(346002)(396003)(376002)(199004)(189003)(8676002)(55016002)(105586002)(68736007)(106356001)(14444005)(305945005)(7736002)(72206003)(4326008)(25786009)(478600001)(2906002)(9686003)(33896004)(97736004)(52116002)(7696005)(76176011)(1076002)(110136005)(54906003)(53936002)(316002)(23726003)(86362001)(6506007)(386003)(476003)(3846002)(6116002)(8936002)(47776003)(8746002)(66066001)(26005)(486006)(81166006)(81156014)(186003)(446003)(16526019)(956004)(6666003)(50226002)(5660300001)(50466002)(11346002)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR0301MB1571;H:xhacker.debian;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR0301MB1571;23:cQWMSq4no38gIjrAqwu54nRit40reQ2TkPAtbtd?= =?us-ascii?Q?kt1gRxWm1lRD6Fn7PV7occudCB/tIvnwmmoc74rTHxr/qpPk5q1STWKD2B8H?= =?us-ascii?Q?t7jgvpLvDQBrfdZpan4HqLaHo5W3IzrbjLfdRexCX65UlBPUFj75FbpOUvTn?= =?us-ascii?Q?MUF7h9TFWeZJ+fXK0Qj5pCi1UDD2iZ1iPHXvfD6VDCb0UfkJiT//Ge1biLhh?= =?us-ascii?Q?gY5ikKZHUvI+OEqq8r+2P+yV8IRnQF0PbXfFa1mIc0tquA1VMQxcVDPiClZq?= =?us-ascii?Q?YlGTVMBYLq9tpC4zLPKe+Sfo+J5RqSsh+yWYMwISE2ViMfpEb46nrbT50yyc?= =?us-ascii?Q?YxynE/GKZ/fBVCf592cNCDi+tFcON7JwMcqBcdJSO4cKv/IbfMbv6lfzjspV?= =?us-ascii?Q?2OeEOQpUVp3iOZbtAibKRR1Q9o1RRwWPSONrw8kKIczoUW7qOml2mWr5nptZ?= =?us-ascii?Q?/X9/9ajckjWjYT2BPzAbgfrErwtKu7iD8h2lkjPVTZcQfHKhGaLgcQBZQSFl?= =?us-ascii?Q?TCU7e6o6pJq61SVNZSSEDwyGW9YtrdRoD791gliH3DsMJP1ec2rUGXALVkrs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s3m SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2018 08:33:26.4734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c07545e-34ab-4c17-3c45-08d60d8a18db X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB1571 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the loop of mvneta_tx_done_gbe(), we call the smp_processor_id() each time, move the call out of the loop to optimize the code a bit. Before the patch, the loop looks like(under arm64): ldr x1, [x29,#120] ... ldr w24, [x1,#36] ... bl 0 <_raw_spin_lock> str w24, [x27,#132] ... After the patch, the loop looks like(under arm64): ... bl 0 <_raw_spin_lock> str w23, [x28,#132] ... where w23 is loaded so be ready before the loop. =46rom another side, mvneta_tx_done_gbe() is called from mvneta_poll() which is in non-preemptible context, so it's safe to call the smp_processor_id() function once. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/marvell/mvneta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/m= arvell/mvneta.c index 7d98f7828a30..62e81e267e13 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -2507,12 +2507,13 @@ static void mvneta_tx_done_gbe(struct mvneta_port *= pp, u32 cause_tx_done) { struct mvneta_tx_queue *txq; struct netdev_queue *nq; + int cpu =3D smp_processor_id(); =20 while (cause_tx_done) { txq =3D mvneta_tx_done_policy(pp, cause_tx_done); =20 nq =3D netdev_get_tx_queue(pp->dev, txq->id); - __netif_tx_lock(nq, smp_processor_id()); + __netif_tx_lock(nq, cpu); =20 if (txq->count) mvneta_txq_done(pp, txq); --=20 2.18.0