From: Prashant Bhole Date: Tue, 11 Dec 2018 02:43:07 +0000 (+0900) Subject: tun: replace get_cpu_ptr with this_cpu_ptr when bh disabled X-Git-Tag: v5.4-rc1~1957^2~100 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6342ca644713601b42dcb8f35e3751afc0943373;p=platform%2Fkernel%2Flinux-rpi.git 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: Jason Wang Signed-off-by: Prashant Bhole Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller --- diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 72577aa..a4fdad4 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -2495,12 +2495,14 @@ build: skb_record_rx_queue(skb, tfile->queue_index); netif_receive_skb(skb); - 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); u64_stats_update_begin(&stats->syncp); stats->rx_packets++; stats->rx_bytes += datasize; u64_stats_update_end(&stats->syncp); - put_cpu_ptr(stats); if (rxhash) tun_flow_update(tun, rxhash, tfile);