Commit 48c2afc
inet: frags: get rid of ipfrag_skb_cb/FRAG_CB
ip_defrag uses skb->cb[] to store the fragment offset, and unfortunately
this integer is currently in a different cache line than skb->next,
meaning that we use two cache lines per skb when finding the insertion point.
By aliasing skb->ip_defrag_offset and skb->dev, we pack all the fields
in a single cache line and save precious memory bandwidth.
Note that after the fast path added by Changli Gao in commit
d6bebca ("fragment: add fast path for in-order fragments")
this change wont help the fast path, since we still need
to access prev->len (2nd cache line), but will show great
benefits when slow path is entered, since we perform
a linear scan of a potentially long list.
Also, note that this potential long list is an attack vector,
we might consider also using an rb-tree there eventually.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bf66337)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 8291cd9 commit 48c2afc
2 files changed
Lines changed: 15 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
678 | 678 | | |
679 | 679 | | |
680 | 680 | | |
| 681 | + | |
681 | 682 | | |
682 | 683 | | |
683 | 684 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 60 | | |
69 | 61 | | |
70 | 62 | | |
| |||
353 | 345 | | |
354 | 346 | | |
355 | 347 | | |
356 | | - | |
| 348 | + | |
357 | 349 | | |
358 | 350 | | |
359 | 351 | | |
360 | 352 | | |
361 | 353 | | |
362 | | - | |
| 354 | + | |
363 | 355 | | |
364 | 356 | | |
365 | 357 | | |
| |||
370 | 362 | | |
371 | 363 | | |
372 | 364 | | |
373 | | - | |
| 365 | + | |
374 | 366 | | |
375 | 367 | | |
376 | 368 | | |
| |||
387 | 379 | | |
388 | 380 | | |
389 | 381 | | |
390 | | - | |
391 | | - | |
| 382 | + | |
| 383 | + | |
392 | 384 | | |
393 | 385 | | |
394 | 386 | | |
| |||
401 | 393 | | |
402 | 394 | | |
403 | 395 | | |
404 | | - | |
| 396 | + | |
405 | 397 | | |
406 | 398 | | |
407 | 399 | | |
| |||
425 | 417 | | |
426 | 418 | | |
427 | 419 | | |
428 | | - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
429 | 427 | | |
430 | 428 | | |
431 | 429 | | |
| |||
436 | 434 | | |
437 | 435 | | |
438 | 436 | | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | 437 | | |
445 | 438 | | |
446 | 439 | | |
| |||
516 | 509 | | |
517 | 510 | | |
518 | 511 | | |
519 | | - | |
| 512 | + | |
520 | 513 | | |
521 | 514 | | |
522 | 515 | | |
| |||
0 commit comments