Commit 6342ca64 authored by Prashant Bhole's avatar Prashant Bhole Committed by David S. Miller
Browse files

tun: replace get_cpu_ptr with this_cpu_ptr when bh disabled

tun_xdp_one() runs with local bh disabled. So there is no need to
disable preemption by calling get_cpu_ptr while updating stats. This
patch replaces the use of get_cpu_ptr() with this_cpu_ptr() as a
micro-optimization. Also removes related put_cpu_ptr call.

Acked-by: default avatarJason Wang <>
Signed-off-by: default avatarPrashant Bhole <>
Acked-by: default avatarMichael S. Tsirkin <>
Signed-off-by: default avatarDavid S. Miller <>
parent c2c79a32
......@@ -2495,12 +2495,14 @@ build:
skb_record_rx_queue(skb, tfile->queue_index);
stats = get_cpu_ptr(tun->pcpu_stats);
/* No need for get_cpu_ptr() here since this function is
* always called with bh disabled
stats = this_cpu_ptr(tun->pcpu_stats);
stats->rx_bytes += datasize;
if (rxhash)
tun_flow_update(tun, rxhash, tfile);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment