Commit c4d6be4
netfilter: nf_tables: store new sets in dedicated list
[ Upstream commit c1aa388 ]
nft_set_lookup_byid() is very slow when transaction becomes large, due to
walk of the transaction list.
Add a dedicated list that contains only the new sets.
Before: nft -f ruleset 0.07s user 0.00s system 0% cpu 1:04.84 total
After: nft -f ruleset 0.07s user 0.00s system 0% cpu 30.115 total
.. where ruleset contains ~10 sets with ~100k elements.
The above number is for a combined flush+reload of the ruleset.
With previous flush, even the first NEWELEM has to walk through a few
hundred thousands of DELSET(ELEM) transactions before the first NEWSET
object. To cope with random-order-newset-newsetelem we'd need to replace
commit_set_list with a hashtable.
Expectation is that a NEWELEM operation refers to the most recently added
set, so last entry of the dedicated list should be the set we want.
NB: This is not a bug fix per se (functionality is fine), but with
larger transaction batches list search takes forever, so it would be
nice to speed this up for -stable too, hence adding a "fixes" tag.
Fixes: 958bee1 ("netfilter: nf_tables: use new transaction infrastructure to handle sets")
Reported-by: Nadia Pinaeva <n.m.pinaeva@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent eac1568 commit c4d6be4
File tree
2 files changed
+22
-9
lines changed- include/net/netfilter
- net/netfilter
2 files changed
+22
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1674 | 1674 | | |
1675 | 1675 | | |
1676 | 1676 | | |
| 1677 | + | |
1677 | 1678 | | |
1678 | 1679 | | |
1679 | 1680 | | |
| |||
1875 | 1876 | | |
1876 | 1877 | | |
1877 | 1878 | | |
| 1879 | + | |
1878 | 1880 | | |
1879 | 1881 | | |
1880 | 1882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
396 | 397 | | |
397 | 398 | | |
398 | 399 | | |
| |||
402 | 403 | | |
403 | 404 | | |
404 | 405 | | |
| 406 | + | |
| 407 | + | |
405 | 408 | | |
406 | 409 | | |
407 | 410 | | |
| 411 | + | |
| 412 | + | |
408 | 413 | | |
409 | 414 | | |
410 | 415 | | |
| |||
611 | 616 | | |
612 | 617 | | |
613 | 618 | | |
| 619 | + | |
614 | 620 | | |
615 | 621 | | |
616 | 622 | | |
| |||
4485 | 4491 | | |
4486 | 4492 | | |
4487 | 4493 | | |
4488 | | - | |
| 4494 | + | |
4489 | 4495 | | |
4490 | | - | |
4491 | | - | |
4492 | | - | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
4493 | 4499 | | |
4494 | | - | |
4495 | | - | |
4496 | | - | |
4497 | | - | |
4498 | | - | |
| 4500 | + | |
| 4501 | + | |
| 4502 | + | |
| 4503 | + | |
4499 | 4504 | | |
4500 | 4505 | | |
4501 | 4506 | | |
| |||
10447 | 10452 | | |
10448 | 10453 | | |
10449 | 10454 | | |
| 10455 | + | |
10450 | 10456 | | |
10451 | 10457 | | |
10452 | 10458 | | |
| |||
10755 | 10761 | | |
10756 | 10762 | | |
10757 | 10763 | | |
| 10764 | + | |
10758 | 10765 | | |
10759 | 10766 | | |
10760 | 10767 | | |
| |||
10850 | 10857 | | |
10851 | 10858 | | |
10852 | 10859 | | |
| 10860 | + | |
| 10861 | + | |
10853 | 10862 | | |
10854 | 10863 | | |
10855 | 10864 | | |
| |||
11519 | 11528 | | |
11520 | 11529 | | |
11521 | 11530 | | |
| 11531 | + | |
11522 | 11532 | | |
11523 | 11533 | | |
11524 | 11534 | | |
| |||
11549 | 11559 | | |
11550 | 11560 | | |
11551 | 11561 | | |
| 11562 | + | |
11552 | 11563 | | |
11553 | 11564 | | |
11554 | 11565 | | |
| |||
0 commit comments