Page MenuHomeFreeBSD

Migrate in_ifaddr_lock and in6_ifaddr_lock to rmlock
ClosedPublic

Authored by ae on Jul 22 2015, 11:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 29, 4:34 PM
Unknown Object (File)
Sep 22 2024, 7:44 PM
Unknown Object (File)
Sep 20 2024, 3:19 AM
Unknown Object (File)
Sep 18 2024, 6:12 PM
Unknown Object (File)
Sep 18 2024, 2:55 PM
Unknown Object (File)
Sep 17 2024, 4:02 PM
Unknown Object (File)
Sep 8 2024, 10:29 PM
Unknown Object (File)
Sep 8 2024, 6:49 PM
Subscribers

Details

Summary

These two locks are used to protect access to IP addresses lists. When system has many IP (v4 or v6) addresses rwlock shows poor performance on high packet rate when many CPU cores are used, because of high contention. If we compare how many times these locks are acquired for reading for each packet on traffic flow (in_localip, in6_localip, etc.), and for writing when we are changing IP addresses - it is better to use read-mostly lock here.

Test Plan

We use similar patch more than a year in production.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ae retitled this revision from to Migrate in_ifaddr_lock and in6_ifaddr_lock to rmlock.
ae updated this object.
ae edited the test plan for this revision. (Show Details)
ae added reviewers: network, np, melifaro.
ae set the repository for this revision to rS FreeBSD src repository - subversion.
gnn requested changes to this revision.Jul 27 2015, 3:15 PM
gnn added a reviewer: gnn.
gnn added a subscriber: gnn.

I don't know of any other place in the kernel where we use a macro to declare a function local variable. Please revert that part to look like the rest of the kernel. The rest of the change looks fine to me.

This revision now requires changes to proceed.Jul 27 2015, 3:15 PM

I used the macro to minimize the diff. Also, with such macro it is easy to switch back to rwlock, or some other type of lock. But ok, I'll update the patch.

ae edited edge metadata.
ae edited the test plan for this revision. (Show Details)

Don't use macro to declare rm_priotracker.
Pass it as argument to *RLOCK/RUNLOCK macros, also update IFP_TO_IA() macro.

This revision was automatically updated to reflect the committed changes.