Page MenuHomeFreeBSD

Improve layout of struct inpcb

Authored by glebius on May 11 2017, 9:13 PM.


  • Rearrange struct inpcb fields to optimize the TCP output code path considering cache line hits and misses. Put the lock and hash list glue into the first cache line, put inp_refcount inp_flags inp_socket into the second cache line. This has been tested at Netflix.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

glebius created this revision.May 11 2017, 9:13 PM
jch added a subscriber: jch.May 11 2017, 9:19 PM
gnn added a reviewer: bz.May 12 2017, 12:48 PM
bz requested changes to this revision.May 12 2017, 12:57 PM

Could this please be multiple individual changes.
The function argument change is completely independent of the struct reordering.

If people would want to do alternate performance validation on the struct changes, I'd really like to have just that.


This revision now requires changes to proceed.May 12 2017, 12:57 PM

Yes, this will be two separate commits.

Anybody is welcome to do alternate performance validation. At Netflix we found this layout of the structure optimal.

glebius updated this revision to Diff 28385.May 15 2017, 10:03 PM
glebius edited edge metadata.

Reduce to the structure layout change only.

glebius retitled this revision from Tweaks and fixes to the inpcb allocation. to Improve layout of struct inpcb.May 15 2017, 10:03 PM
glebius edited the summary of this revision. (Show Details)
bz added a comment.May 18 2017, 4:42 PM

Did the other changes get in already or are they in a different review? I will try to see what this one does in a different setup during the next days (I hope).

The other changes are already in.

glebius edited the summary of this revision. (Show Details)May 18 2017, 6:14 PM