Page MenuHomeFreeBSD

ip_mroute: rework ip_mroute
ClosedPublic

Authored by wma on May 20 2021, 8:18 AM.
Tags
None
Referenced Files
F102421522: D30354.diff
Tue, Nov 12, 1:27 AM
Unknown Object (File)
Oct 4 2024, 11:05 PM
Unknown Object (File)
Oct 1 2024, 11:39 PM
Unknown Object (File)
Sep 28 2024, 6:34 AM
Unknown Object (File)
Sep 27 2024, 11:12 PM
Unknown Object (File)
Sep 26 2024, 2:18 AM
Unknown Object (File)
Sep 26 2024, 2:18 AM
Unknown Object (File)
Sep 26 2024, 2:05 AM
Subscribers

Details

Summary
Changes:
1. add spinlock to bw_meter

If two contexts read and modify bw_meter values
it might happen that these are corrupted.
Guard only code fragments which do read-and-modify.
Context which only do "reads" are not done inside
spinlock block. The only sideffect that can happen is
an 1-p;acket outdated value reported back to userspace.

2. replace all locks with a single RWLOCK

Multiple locks caused a performance issue in routing
hot path, when two of them had to be taken. All locks
were replaced with single RWLOCK which makes the hot
path able to take only shared access to lock most of
the times.
All configuration routines have to take exclusive lock
(as it was done before) but these operation are very rare
compared to packet routing.

3. redesign MFC expire and UPCALL expire

Use generic kthread and cv_wait/cv_signal for deferring
work. Previously, upcalls could be sent from two contexts
which complicated the design. All upcall sending is now
done in a kthread which allows hot path to work more
efficient in some rare cases.

4. replace mutex-guarded linked list with lock free buf_ring

All message and data is now passed over lockless buf_ring.
This allowed to remove some heavy locking when linked
lists were used.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

wma requested review of this revision.May 20 2021, 8:18 AM
sys/netinet/ip_mroute.c
2193

add bu free here

This revision is now accepted and ready to land.May 28 2021, 9:41 AM
This revision was automatically updated to reflect the committed changes.