Commit 6be6a8e
committed
erts: Only save the priority around setting IP_TOS
Every setsockopt went through a save and restore of both SO_PRIORITY
and IP_TOS, on the grounds that "if any other option is set after tos,
tos might be zeroed" - a comment carried over from the inet driver.
That costs two getsockopt calls and up to two more setsockopt calls on
every option set.
Only half of it holds. Setting IP_TOS does make the kernel derive a new
SO_PRIORITY from it, so that one option has to put the priority back.
Setting SO_PRIORITY leaves the tos alone, and so does setting anything
else: verified on Linux 7.0 with TCP_NODELAY, SO_RCVBUF and SO_LINGER,
none of which disturbed either value.
So do it only for IP_TOS, and only for the priority. Setting an option
on an accepted connection goes from four system calls to one. The
socket options a connection sets still look independent to the user,
which is what the dance was there for.1 parent ea8f22b commit 6be6a8e
1 file changed
Lines changed: 30 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11471 | 11471 | | |
11472 | 11472 | | |
11473 | 11473 | | |
11474 | | - | |
11475 | | - | |
11476 | | - | |
11477 | | - | |
11478 | | - | |
11479 | | - | |
11480 | | - | |
11481 | | - | |
11482 | | - | |
11483 | | - | |
11484 | | - | |
| 11474 | + | |
| 11475 | + | |
| 11476 | + | |
| 11477 | + | |
| 11478 | + | |
| 11479 | + | |
| 11480 | + | |
| 11481 | + | |
| 11482 | + | |
| 11483 | + | |
| 11484 | + | |
11485 | 11485 | | |
11486 | | - | |
11487 | | - | |
| 11486 | + | |
| 11487 | + | |
11488 | 11488 | | |
11489 | | - | |
11490 | | - | |
11491 | | - | |
| 11489 | + | |
11492 | 11490 | | |
11493 | | - | |
11494 | | - | |
11495 | | - | |
11496 | | - | |
11497 | | - | |
11498 | | - | |
11499 | | - | |
11500 | | - | |
11501 | | - | |
11502 | | - | |
11503 | | - | |
11504 | | - | |
11505 | | - | |
11506 | | - | |
11507 | | - | |
11508 | | - | |
11509 | | - | |
11510 | | - | |
11511 | | - | |
11512 | | - | |
11513 | | - | |
11514 | | - | |
11515 | | - | |
11516 | | - | |
11517 | | - | |
| 11491 | + | |
| 11492 | + | |
| 11493 | + | |
11518 | 11494 | | |
11519 | | - | |
| 11495 | + | |
| 11496 | + | |
| 11497 | + | |
| 11498 | + | |
11520 | 11499 | | |
11521 | | - | |
| 11500 | + | |
| 11501 | + | |
| 11502 | + | |
| 11503 | + | |
| 11504 | + | |
11522 | 11505 | | |
| 11506 | + | |
| 11507 | + | |
11523 | 11508 | | |
11524 | 11509 | | |
| 11510 | + | |
| 11511 | + | |
11525 | 11512 | | |
11526 | 11513 | | |
11527 | 11514 | | |
| |||
0 commit comments