Commit f6e63cfb5cfcccca510672155b90dd39bf45a35f
Exists in
master
and in
7 other branches
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Showing 2 changed files Side-by-side Diff
net/ipv4/fib_trie.c
... | ... | @@ -286,6 +286,8 @@ |
286 | 286 | |
287 | 287 | static int halve_threshold = 25; |
288 | 288 | static int inflate_threshold = 50; |
289 | +static int halve_threshold_root = 15; | |
290 | +static int inflate_threshold_root = 25; | |
289 | 291 | |
290 | 292 | |
291 | 293 | static void __alias_free_mem(struct rcu_head *head) |
... | ... | @@ -449,6 +451,8 @@ |
449 | 451 | int i; |
450 | 452 | int err = 0; |
451 | 453 | struct tnode *old_tn; |
454 | + int inflate_threshold_use; | |
455 | + int halve_threshold_use; | |
452 | 456 | |
453 | 457 | if (!tn) |
454 | 458 | return NULL; |
455 | 459 | |
... | ... | @@ -541,10 +545,17 @@ |
541 | 545 | |
542 | 546 | check_tnode(tn); |
543 | 547 | |
548 | + /* Keep root node larger */ | |
549 | + | |
550 | + if(!tn->parent) | |
551 | + inflate_threshold_use = inflate_threshold_root; | |
552 | + else | |
553 | + inflate_threshold_use = inflate_threshold; | |
554 | + | |
544 | 555 | err = 0; |
545 | 556 | while ((tn->full_children > 0 && |
546 | 557 | 50 * (tn->full_children + tnode_child_length(tn) - tn->empty_children) >= |
547 | - inflate_threshold * tnode_child_length(tn))) { | |
558 | + inflate_threshold_use * tnode_child_length(tn))) { | |
548 | 559 | |
549 | 560 | old_tn = tn; |
550 | 561 | tn = inflate(t, tn); |
551 | 562 | |
... | ... | @@ -564,10 +575,18 @@ |
564 | 575 | * node is above threshold. |
565 | 576 | */ |
566 | 577 | |
578 | + | |
579 | + /* Keep root node larger */ | |
580 | + | |
581 | + if(!tn->parent) | |
582 | + halve_threshold_use = halve_threshold_root; | |
583 | + else | |
584 | + halve_threshold_use = halve_threshold; | |
585 | + | |
567 | 586 | err = 0; |
568 | 587 | while (tn->bits > 1 && |
569 | 588 | 100 * (tnode_child_length(tn) - tn->empty_children) < |
570 | - halve_threshold * tnode_child_length(tn)) { | |
589 | + halve_threshold_use * tnode_child_length(tn)) { | |
571 | 590 | |
572 | 591 | old_tn = tn; |
573 | 592 | tn = halve(t, tn); |
net/ipv6/udp.c
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | next:; |
100 | 100 | } |
101 | 101 | result = best; |
102 | - for(;; result += UDP_HTABLE_SIZE) { | |
102 | + for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { | |
103 | 103 | if (result > sysctl_local_port_range[1]) |
104 | 104 | result = sysctl_local_port_range[0] |
105 | 105 | + ((result - sysctl_local_port_range[0]) & |
... | ... | @@ -107,6 +107,8 @@ |
107 | 107 | if (!udp_lport_inuse(result)) |
108 | 108 | break; |
109 | 109 | } |
110 | + if (i >= (1 << 16) / UDP_HTABLE_SIZE) | |
111 | + goto fail; | |
110 | 112 | gotit: |
111 | 113 | udp_port_rover = snum = result; |
112 | 114 | } else { |