ofproto-dpif-xlate: Avoid MAC learning write lock on fast path.
authorBen Pfaff <blp@nicira.com>
Wed, 7 Aug 2013 03:35:29 +0000 (20:35 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 9 Aug 2013 20:35:34 +0000 (13:35 -0700)
commitee047520f66b174f6a36beb63e7aaf40526eb0af
tree051b7f6bb60eebd268ee07243648c4c5aa7afe42
parent0b4f207828c9354761efc60bd9ab90898d9cc623
ofproto-dpif-xlate: Avoid MAC learning write lock on fast path.

Most of the trips through update_learning_table() do not actually change
the MAC learning table, but because some do the code there took the
MAC learning table's write lock.  This commit changes the common case to
take only the read lock, falling back to the write lock if a change was
actually necessary.

Ethan reported that this gave a 3.3x performance improvement in one test
case due to reduced lock contention.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto/ofproto-dpif-xlate.c