aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2009-07-14 05:41:00 -0400
committerDavid S. Miller <davem@davemloft.net>2009-07-20 10:39:29 -0400
commitbe916cdebe4dc720a23b1a9bb589f2c22afd6589 (patch)
tree310a6de2576aaf6e5a87463ee89bf7bea745badd /net/ipv4/fib_trie.c
parentc3059477fce2d956a0bb3e04357324780c5d8eeb (diff)
ipv4: Fix inflate_threshold_root automatically
During large updates there could be triggered warnings like: "Fix inflate_threshold_root. Now=25 size=11 bits" if inflate() of the root node isn't finished in 10 loops. It should be much rarer now, after changing the threshold from 15 to 25, and a temporary problem, so this patch tries to handle it automatically using a fix variable to increase by one inflate threshold for next root resizes (up to the 35 limit, max fix = 10). The fix variable is decreased when root's inflate() finishes below 7 loops (even if some other, smaller table/ trie is updated -- for simplicity the fix variable is global for now). Reported-by: Pawel Staszewski <pstaszewski@itcare.pl> Reported-by: Jorge Boncompte [DTI2] <jorge@dti2.net> Tested-by: Pawel Staszewski <pstaszewski@itcare.pl> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: Robert Olsson <robert.olsson@its.uu.se> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c29
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;
327static const int halve_threshold_root = 15; 327static const int halve_threshold_root = 15;
328static const int inflate_threshold_root = 25; 328static const int inflate_threshold_root = 25;
329 329
330static int inflate_threshold_root_fix;
331#define INFLATE_FIX_MAX 10 /* a comment in resize() */
330 332
331static void __alias_free_mem(struct rcu_head *head) 333static 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