Skip to content

Commit

Permalink
netfilter: nf_conntrack: consolidate lock/unlock into unlock_wait
Browse files Browse the repository at this point in the history
The spin_lock()/spin_unlock() is synchronizing on the
nf_conntrack_locks_all_lock which is equivalent to
spin_unlock_wait() but the later should be more efficient.

Signed-off-by: Nicholas Mc Guire <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
Nicholas Mc Guire authored and ummakynes committed Mar 15, 2016
1 parent 0575252 commit e39365b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/netfilter/nf_conntrack_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ void nf_conntrack_lock(spinlock_t *lock) __acquires(lock)
spin_lock(lock);
while (unlikely(nf_conntrack_locks_all)) {
spin_unlock(lock);
spin_lock(&nf_conntrack_locks_all_lock);
spin_unlock(&nf_conntrack_locks_all_lock);
spin_unlock_wait(&nf_conntrack_locks_all_lock);
spin_lock(lock);
}
}
Expand Down Expand Up @@ -121,8 +120,7 @@ static void nf_conntrack_all_lock(void)
nf_conntrack_locks_all = true;

for (i = 0; i < CONNTRACK_LOCKS; i++) {
spin_lock(&nf_conntrack_locks[i]);
spin_unlock(&nf_conntrack_locks[i]);
spin_unlock_wait(&nf_conntrack_locks[i]);
}
}

Expand Down

0 comments on commit e39365b

Please sign in to comment.