Page MenuHomeFreeBSD

tcp: embed inpcb into tcpcb
AbandonedPublic

Authored by glebius on Oct 25 2022, 6:58 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 11 2024, 10:30 AM
Unknown Object (File)
Mar 11 2024, 10:30 AM
Unknown Object (File)
Mar 8 2024, 12:12 AM
Unknown Object (File)
Jan 21 2024, 4:25 AM
Unknown Object (File)
Dec 25 2023, 1:03 PM
Unknown Object (File)
Dec 25 2023, 1:03 PM
Unknown Object (File)
Dec 25 2023, 12:52 PM
Unknown Object (File)
Dec 23 2023, 10:34 AM

Details

Reviewers
None
Group Reviewers
transport
Commits
rGe68b3792440c: tcp: embed inpcb into tcpcb
Summary

For the TCP protocol inpcb storage specify allocation size that would
provide space to most of the data a TCP connection needs, embedding
into struct tcpcb several structures, that previously were allocated
separately.

The most import one is the inpcb itself. With embedding we can provide
strong guarantee that with a valid TCP inpcb the tcpcb is always valid
and vice versa. Also we reduce number of allocs/frees per connection.
The embedded inpcb is placed in the beginning of the struct tcpcb,
since in_pcballoc() requires that. However, later we may want to move
it around for cache line efficiency, and this can be done with a little
effort. The new intotcpcb() macro is ready for such move.

The congestion algorithm data, the TCP timers and osd(9) data are
also embedded into tcpcb, and temprorary struct tcpcb_mem goes away.
There was no extra allocation here, but we went through extra pointer
every time we accessed this data.

One interesting side effect is that now TCP data is allocated from
SMR-protected zone. Potentially this allows the TCP stacks or other
TCP related modules to utilize that for their own synchronization.

Large part of the change was done with sed script:

s/tp->ccv->/tp->t_ccv./g
s/tp->ccv/\&tp->t_ccv/g
s/tp->cc_algo/tp->t_cc/g
s/tp->t_timers->tt_/tp->tt_/g
s/CCV\(ccv, osd\)/\&CCV(ccv, t_osd)/g

Dependency side effect is that code that needs to know struct tcpcb
should also know struct inpcb, that added several <netinet/in_pcb.h>.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 47997
Build 44884: arc lint + arc unit