Commit 4890b68
net: keep sk->sk_forward_alloc as small as possible
Currently, tcp_memory_allocated can hit tcp_mem[] limits quite fast.
Each TCP socket can forward allocate up to 2 MB of memory, even after
flow became less active.
10,000 sockets can have reserved 20 GB of memory,
and we have no shrinker in place to reclaim that.
Instead of trying to reclaim the extra allocations in some places,
just keep sk->sk_forward_alloc values as small as possible.
This should not impact performance too much now we have per-cpu
reserves: Changes to tcp_memory_allocated should not be too frequent.
For sockets not using SO_RESERVE_MEM:
- idle sockets (no packets in tx/rx queues) have zero forward alloc.
- non idle sockets have a forward alloc smaller than one page.
Note:
- Removal of SK_RECLAIM_CHUNK and SK_RECLAIM_THRESHOLD
is left to MPTCP maintainers as a follow up.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 7c80b03 commit 4890b68
File tree
11 files changed
+7
-72
lines changed- include/net
- net
- core
- ipv4
- iucv
- mptcp
- sctp
11 files changed
+7
-72
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1627 | 1627 | | |
1628 | 1628 | | |
1629 | 1629 | | |
1630 | | - | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
1634 | | - | |
1635 | | - | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
1643 | 1630 | | |
1644 | 1631 | | |
1645 | 1632 | | |
1646 | 1633 | | |
1647 | 1634 | | |
1648 | 1635 | | |
1649 | 1636 | | |
1650 | | - | |
| 1637 | + | |
1651 | 1638 | | |
1652 | 1639 | | |
1653 | 1640 | | |
1654 | 1641 | | |
1655 | 1642 | | |
1656 | 1643 | | |
1657 | | - | |
1658 | | - | |
1659 | 1644 | | |
1660 | 1645 | | |
1661 | 1646 | | |
1662 | | - | |
1663 | | - | |
1664 | | - | |
1665 | | - | |
1666 | | - | |
1667 | | - | |
1668 | | - | |
1669 | | - | |
1670 | | - | |
1671 | | - | |
1672 | | - | |
| 1647 | + | |
1673 | 1648 | | |
1674 | 1649 | | |
1675 | 1650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
324 | 323 | | |
325 | 324 | | |
326 | 325 | | |
| |||
336 | 335 | | |
337 | 336 | | |
338 | 337 | | |
339 | | - | |
340 | 338 | | |
341 | 339 | | |
342 | 340 | | |
| |||
396 | 394 | | |
397 | 395 | | |
398 | 396 | | |
399 | | - | |
400 | 397 | | |
401 | 398 | | |
402 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | 861 | | |
865 | 862 | | |
866 | 863 | | |
| |||
2764 | 2761 | | |
2765 | 2762 | | |
2766 | 2763 | | |
2767 | | - | |
2768 | | - | |
2769 | 2764 | | |
2770 | 2765 | | |
2771 | 2766 | | |
| |||
2873 | 2868 | | |
2874 | 2869 | | |
2875 | 2870 | | |
2876 | | - | |
2877 | 2871 | | |
2878 | 2872 | | |
2879 | 2873 | | |
| |||
2951 | 2945 | | |
2952 | 2946 | | |
2953 | 2947 | | |
2954 | | - | |
2955 | 2948 | | |
2956 | 2949 | | |
2957 | 2950 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | | - | |
809 | 808 | | |
810 | 809 | | |
811 | 810 | | |
| |||
4390 | 4389 | | |
4391 | 4390 | | |
4392 | 4391 | | |
4393 | | - | |
4394 | 4392 | | |
4395 | 4393 | | |
4396 | 4394 | | |
| |||
5336 | 5334 | | |
5337 | 5335 | | |
5338 | 5336 | | |
5339 | | - | |
5340 | 5337 | | |
5341 | 5338 | | |
5342 | 5339 | | |
| |||
5383 | 5380 | | |
5384 | 5381 | | |
5385 | 5382 | | |
5386 | | - | |
5387 | 5383 | | |
5388 | 5384 | | |
5389 | 5385 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
294 | | - | |
295 | 293 | | |
296 | 294 | | |
297 | | - | |
| 295 | + | |
298 | 296 | | |
299 | 297 | | |
300 | 298 | | |
301 | | - | |
| 299 | + | |
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
| |||
317 | 315 | | |
318 | 316 | | |
319 | 317 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | 318 | | |
325 | 319 | | |
326 | 320 | | |
| |||
600 | 594 | | |
601 | 595 | | |
602 | 596 | | |
603 | | - | |
| 597 | + | |
604 | 598 | | |
605 | 599 | | |
606 | 600 | | |
607 | | - | |
| 601 | + | |
608 | 602 | | |
609 | 603 | | |
610 | 604 | | |
| |||
626 | 620 | | |
627 | 621 | | |
628 | 622 | | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | 623 | | |
633 | 624 | | |
634 | 625 | | |
| |||
743 | 734 | | |
744 | 735 | | |
745 | 736 | | |
746 | | - | |
747 | | - | |
748 | 737 | | |
749 | 738 | | |
750 | 739 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
282 | | - | |
283 | 281 | | |
284 | 282 | | |
285 | 283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
975 | 975 | | |
976 | 976 | | |
977 | 977 | | |
978 | | - | |
| 978 | + | |
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6590 | 6590 | | |
6591 | 6591 | | |
6592 | 6592 | | |
6593 | | - | |
6594 | | - | |
6595 | 6593 | | |
6596 | 6594 | | |
6597 | 6595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1824 | 1824 | | |
1825 | 1825 | | |
1826 | 1826 | | |
1827 | | - | |
1828 | | - | |
1829 | | - | |
1830 | 1827 | | |
1831 | 1828 | | |
1832 | 1829 | | |
| |||
9195 | 9192 | | |
9196 | 9193 | | |
9197 | 9194 | | |
9198 | | - | |
9199 | | - | |
9200 | 9195 | | |
9201 | 9196 | | |
9202 | 9197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
979 | 979 | | |
980 | 980 | | |
981 | 981 | | |
982 | | - | |
983 | | - | |
984 | 982 | | |
985 | 983 | | |
986 | 984 | | |
| |||
0 commit comments