diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-08-08 03:49:16 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-08-08 05:57:25 +0200 |
commit | 11e8b76f9ee01feed3ae402ffb49721c070ff20f (patch) | |
tree | 5929c9dc0329b064bf4d73df4a6f20b33d86b3f1 /src | |
parent | 5f645927224801171ec043e2f6a2ed7b3998cdc2 (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.c | 5 |
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; } } |