Commit 76eb946040a7b4c797979a9c22464b9a07890ba5

Authored by Patrick McHardy
Committed by David S. Miller
1 parent ffaa9c100b

[NETFILTER]: nf_conntrack: don't inline early_drop()

early_drop() is only called *very* rarely, unfortunately gcc inlines it
into the hotpath because there is only a single caller. Explicitly mark
it noinline.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

net/netfilter/nf_conntrack_core.c
... ... @@ -420,7 +420,7 @@
420 420  
421 421 /* There's a small race here where we may free a just-assured
422 422 connection. Too bad: we're in trouble anyway. */
423   -static int early_drop(unsigned int hash)
  423 +static noinline int early_drop(unsigned int hash)
424 424 {
425 425 /* Use oldest entry, which is roughly LRU */
426 426 struct nf_conntrack_tuple_hash *h;
... ... @@ -472,8 +472,8 @@
472 472 /* We don't want any race condition at early drop stage */
473 473 atomic_inc(&nf_conntrack_count);
474 474  
475   - if (nf_conntrack_max
476   - && atomic_read(&nf_conntrack_count) > nf_conntrack_max) {
  475 + if (nf_conntrack_max &&
  476 + unlikely(atomic_read(&nf_conntrack_count) > nf_conntrack_max)) {
477 477 unsigned int hash = hash_conntrack(orig);
478 478 if (!early_drop(hash)) {
479 479 atomic_dec(&nf_conntrack_count);