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)
Feb 16 2024, 6:07 AM
Unknown Object (File)
Feb 16 2024, 5:09 AM
Unknown Object (File)
Feb 3 2024, 12:02 PM
Unknown Object (File)
Dec 20 2023, 1:32 AM
Unknown Object (File)
Nov 17 2023, 7:00 AM
Unknown Object (File)
Sep 21 2023, 7:03 PM
Unknown Object (File)
Aug 25 2023, 10:26 AM
Unknown Object (File)
Jul 5 2023, 2:39 AM
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.