Skip to content

Commit

Permalink
netfilter: nft_set_pipapo: Don't abuse unlikely() in pipapo_refill()
Browse files Browse the repository at this point in the history
I originally used unlikely() in the if (match_only) clause, which
we hit on the mapping table for the last field in a set, to ensure
we avoid branching to the rest of for loop body, which is executed
more frequently.

However, Pablo reports, this is confusing as it gives the impression
that this is not a common case, and it's actually not the intended
usage of unlikely().

I couldn't observe any statistical difference in matching rates on
x864_64 and aarch64 without it, so just drop it.

Reported-by: Pablo Neira Ayuso <[email protected]>
Fixes: 3c4287f ("nf_tables: Add set type for arbitrary concatenation of ranges")
Signed-off-by: Stefano Brivio <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
sbrivio-rh authored and ummakynes committed Feb 18, 2020
1 parent bd97ad5 commit 9a77120
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/nft_set_pipapo.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ static int pipapo_refill(unsigned long *map, int len, int rules,
return -1;
}

if (unlikely(match_only)) {
if (match_only) {
bitmap_clear(map, i, 1);
return i;
}
Expand Down

0 comments on commit 9a77120

Please sign in to comment.