From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: <thomas.petazzoni@bootlin.com>, "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Lunn <andrew@lunn.ch>,
Gregory CLEMENT <gregory.clement@bootlin.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe
Date: Wed, 29 Aug 2018 16:30:21 +0800 [thread overview]
Message-ID: <20180829163021.70ce99ab@xhacker.debian> (raw)
In-Reply-To: <20180829162456.2bd69796@xhacker.debian>
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.
From 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 <Jisheng.Zhang@synaptics.com>
---
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/marvell/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 = smp_processor_id();
while (cause_tx_done) {
txq = mvneta_tx_done_policy(pp, cause_tx_done);
nq = netdev_get_tx_queue(pp->dev, txq->id);
- __netif_tx_lock(nq, smp_processor_id());
+ __netif_tx_lock(nq, cpu);
if (txq->count)
mvneta_txq_done(pp, txq);
--
2.18.0
next prev parent reply other threads:[~2018-08-29 8:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 8:25 [PATCH 0/5] net: mvneta: some bug fix and trivial improvement Jisheng Zhang
2018-08-29 8:27 ` [PATCH 1/5] net: mvneta: fix rx_offset_correction set and usage Jisheng Zhang
2018-08-29 9:05 ` Gregory CLEMENT
2018-08-29 9:16 ` Jisheng Zhang
2018-08-29 8:27 ` [PATCH 2/5] net: mvneta: fix the wrong function to unmap rx buf Jisheng Zhang
2018-08-29 9:21 ` Gregory CLEMENT
2018-08-30 3:40 ` Jisheng Zhang
2018-08-29 8:28 ` [PATCH 3/5] net: mvneta: Don't check NETIF_F_GRO ourself Jisheng Zhang
2018-08-29 9:37 ` Gregory CLEMENT
2018-08-29 8:29 ` [PATCH 4/5] net: mvneta: enable NETIF_F_RXCSUM by default Jisheng Zhang
2018-08-29 9:38 ` Gregory CLEMENT
2018-08-29 13:08 ` Andrew Lunn
2018-08-30 3:27 ` Jisheng Zhang
2018-08-30 3:44 ` Andrew Lunn
2018-08-29 8:30 ` Jisheng Zhang [this message]
2018-08-29 9:44 ` [PATCH 5/5] net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe Gregory CLEMENT
2018-08-29 8:40 ` [PATCH 0/5] net: mvneta: some bug fix and trivial improvement Jisheng Zhang
2018-08-29 8:51 ` Jisheng Zhang
2018-08-30 3:53 ` Jisheng Zhang
2018-08-29 13:12 ` Andrew Lunn
2018-08-30 3:42 ` Jisheng Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180829163021.70ce99ab@xhacker.debian \
--to=jisheng.zhang@synaptics.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=gregory.clement@bootlin.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).