Skip to content

Commit bd9f1ee

Browse files
Jisheng Zhangdavem330
Jisheng Zhang
authored andcommitted
net: mvneta: reduce smp_processor_id() calling in mvneta_tx_done_gbe
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,torvalds#120] ... ldr w24, [x1,torvalds#36] ... bl 0 <_raw_spin_lock> str w24, [x27,torvalds#132] ... After the patch, the loop looks like(under arm64): ... bl 0 <_raw_spin_lock> str w23, [x28,torvalds#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> Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7772988 commit bd9f1ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/marvell/mvneta.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2507,12 +2507,13 @@ static void mvneta_tx_done_gbe(struct mvneta_port *pp, u32 cause_tx_done)
25072507
{
25082508
struct mvneta_tx_queue *txq;
25092509
struct netdev_queue *nq;
2510+
int cpu = smp_processor_id();
25102511

25112512
while (cause_tx_done) {
25122513
txq = mvneta_tx_done_policy(pp, cause_tx_done);
25132514

25142515
nq = netdev_get_tx_queue(pp->dev, txq->id);
2515-
__netif_tx_lock(nq, smp_processor_id());
2516+
__netif_tx_lock(nq, cpu);
25162517

25172518
if (txq->count)
25182519
mvneta_txq_done(pp, txq);

0 commit comments

Comments
 (0)