Skip to content

Commit

Permalink
net: add cpu_relax to busy poll loop
Browse files Browse the repository at this point in the history
Add a cpu_relaxt to sk_busy_loop.

Julie Cummings reported performance issues when hyperthreading is on.
Arjan van de Ven observed that we should have a cpu_relax() in the
busy poll loop.

Reported-by: Julie Cummings <julie.a.cummings@intel.com>
Signed-off-by: Eliezer Tamir <eliezer.tamir@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eliezer Tamir authored and davem330 committed Aug 28, 2013
1 parent 64c3b25 commit 3046e2f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/net/busy_poll.h
Expand Up @@ -123,6 +123,7 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock)
/* local bh are disabled so it is ok to use _BH */
NET_ADD_STATS_BH(sock_net(sk),
LINUX_MIB_BUSYPOLLRXPACKETS, rc);
cpu_relax();

} while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) &&
!need_resched() && !busy_loop_timeout(end_time));
Expand Down

0 comments on commit 3046e2f

Please sign in to comment.