Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: fully inline backlog_unlock_irq_restore()

Some arches (like x86) do not inline spin_unlock_irqrestore().

backlog_unlock_irq_restore() is in RPS/RFS critical path,
we prefer using spin_unlock() + local_irq_restore() for
optimal performance.

Also change backlog_unlock_irq_restore() second argument
to avoid a pointless dereference.

No difference in net/core/dev.o code size.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260105163054.13698-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
27a01c19 3f049b65

+6 -7
+6 -7
net/core/dev.c
··· 246 246 } 247 247 248 248 static inline void backlog_unlock_irq_restore(struct softnet_data *sd, 249 - unsigned long *flags) 249 + unsigned long flags) 250 250 { 251 251 if (IS_ENABLED(CONFIG_RPS) || use_backlog_threads()) 252 - spin_unlock_irqrestore(&sd->input_pkt_queue.lock, *flags); 253 - else 254 - local_irq_restore(*flags); 252 + spin_unlock(&sd->input_pkt_queue.lock); 253 + local_irq_restore(flags); 255 254 } 256 255 257 256 static inline void backlog_unlock_irq_enable(struct softnet_data *sd) ··· 5246 5247 if (!__test_and_set_bit(NAPI_STATE_SCHED, &sd->backlog.state)) 5247 5248 __napi_schedule_irqoff(&sd->backlog); 5248 5249 5249 - backlog_unlock_irq_restore(sd, &flags); 5250 + backlog_unlock_irq_restore(sd, flags); 5250 5251 5251 5252 } else if (!cmpxchg(&sd->defer_ipi_scheduled, 0, 1)) { 5252 5253 smp_call_function_single_async(cpu, &sd->defer_csd); ··· 5333 5334 } 5334 5335 __skb_queue_tail(&sd->input_pkt_queue, skb); 5335 5336 tail = rps_input_queue_tail_incr(sd); 5336 - backlog_unlock_irq_restore(sd, &flags); 5337 + backlog_unlock_irq_restore(sd, flags); 5337 5338 5338 5339 /* save the tail outside of the critical section */ 5339 5340 rps_input_queue_tail_save(qtail, tail); 5340 5341 return NET_RX_SUCCESS; 5341 5342 } 5342 5343 5343 - backlog_unlock_irq_restore(sd, &flags); 5344 + backlog_unlock_irq_restore(sd, flags); 5344 5345 5345 5346 cpu_backlog_drop: 5346 5347 reason = SKB_DROP_REASON_CPU_BACKLOG;