]> git.baikalelectronics.ru Git - kernel.git/commit
net: for rate-limited ICMP replies save one atomic operation
authorJesper Dangaard Brouer <brouer@redhat.com>
Mon, 9 Jan 2017 15:04:14 +0000 (16:04 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Jan 2017 20:49:12 +0000 (15:49 -0500)
commitf7e9882642d56e161b33bb261b6eec2bb2cd78ca
tree23bd866126b5115cf4a14541f7700117a38efc29
parent59808e60b6f1bf100428aeb6dde5e3bdb50e3270
net: for rate-limited ICMP replies save one atomic operation

It is possible to avoid the atomic operation in icmp{v6,}_xmit_lock,
by checking the sysctl_icmp_msgs_per_sec ratelimit before these calls,
as pointed out by Eric Dumazet, but the BH disabled state must be correct.

The icmp_global_allow() call states it must be called with BH
disabled.  This protection was given by the calls icmp_xmit_lock and
icmpv6_xmit_lock.  Thus, split out local_bh_disable/enable from these
functions and maintain it explicitly at callers.

Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/icmp.c
net/ipv6/icmp.c