diff options
-rw-r--r-- | net/ipv4/fib_trie.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 58ba9f4f2c92..5741d1306cc5 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -327,6 +327,8 @@ static const int inflate_threshold = 50; | |||
327 | static const int halve_threshold_root = 15; | 327 | static const int halve_threshold_root = 15; |
328 | static const int inflate_threshold_root = 25; | 328 | static const int inflate_threshold_root = 25; |
329 | 329 | ||
330 | static int inflate_threshold_root_fix; | ||
331 | #define INFLATE_FIX_MAX 10 /* a comment in resize() */ | ||
330 | 332 | ||
331 | static void __alias_free_mem(struct rcu_head *head) | 333 | static void __alias_free_mem(struct rcu_head *head) |
332 | { | 334 | { |
@@ -617,7 +619,8 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
617 | /* Keep root node larger */ | 619 | /* Keep root node larger */ |
618 | 620 | ||
619 | if (!tn->parent) | 621 | if (!tn->parent) |
620 | inflate_threshold_use = inflate_threshold_root; | 622 | inflate_threshold_use = inflate_threshold_root + |
623 | inflate_threshold_root_fix; | ||
621 | else | 624 | else |
622 | inflate_threshold_use = inflate_threshold; | 625 | inflate_threshold_use = inflate_threshold; |
623 | 626 | ||
@@ -641,15 +644,27 @@ static struct node *resize(struct trie *t, struct tnode *tn) | |||
641 | } | 644 | } |
642 | 645 | ||
643 | if (max_resize < 0) { | 646 | if (max_resize < 0) { |
644 | if (!tn->parent) | 647 | if (!tn->parent) { |
645 | pr_warning("Fix inflate_threshold_root." | 648 | /* |
646 | " Now=%d size=%d bits\n", | 649 | * It was observed that during large updates even |
647 | inflate_threshold_root, tn->bits); | 650 | * inflate_threshold_root = 35 might be needed to avoid |
648 | else | 651 | * this warning; but it should be temporary, so let's |
652 | * try to handle this automatically. | ||
653 | */ | ||
654 | if (inflate_threshold_root_fix < INFLATE_FIX_MAX) | ||
655 | inflate_threshold_root_fix++; | ||
656 | else | ||
657 | pr_warning("Fix inflate_threshold_root." | ||
658 | " Now=%d size=%d bits fix=%d\n", | ||
659 | inflate_threshold_root, tn->bits, | ||
660 | inflate_threshold_root_fix); | ||
661 | } else { | ||
649 | pr_warning("Fix inflate_threshold." | 662 | pr_warning("Fix inflate_threshold." |
650 | " Now=%d size=%d bits\n", | 663 | " Now=%d size=%d bits\n", |
651 | inflate_threshold, tn->bits); | 664 | inflate_threshold, tn->bits); |
652 | } | 665 | } |
666 | } else if (max_resize > 3 && !tn->parent && inflate_threshold_root_fix) | ||
667 | inflate_threshold_root_fix--; | ||
653 | 668 | ||
654 | check_tnode(tn); | 669 | check_tnode(tn); |
655 | 670 | ||