summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-08-08 03:49:16 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-08-08 05:57:25 +0200
commit11e8b76f9ee01feed3ae402ffb49721c070ff20f (patch)
tree5929c9dc0329b064bf4d73df4a6f20b33d86b3f1 /src
parent5f645927224801171ec043e2f6a2ed7b3998cdc2 (diff)
hashtables: if we have an index match, don't search further ever
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r--src/hashtables.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hashtables.c b/src/hashtables.c
index b3f5ca3..978997a 100644
--- a/src/hashtables.c
+++ b/src/hashtables.c
@@ -144,8 +144,9 @@ struct index_hashtable_entry *index_hashtable_lookup(struct index_hashtable *tab
struct index_hashtable_entry *iter_entry, *entry = NULL;
rcu_read_lock_bh();
hlist_for_each_entry_rcu_bh (iter_entry, index_bucket(table, index), index_hash) {
- if (iter_entry->index == index && (iter_entry->type & type_mask)) {
- entry = iter_entry;
+ if (iter_entry->index == index) {
+ if (likely(iter_entry->type & type_mask))
+ entry = iter_entry;
break;
}
}