diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-06 20:16:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-07-06 20:16:09 -0400 |
commit | 47a716cf0ca981b9549ec9815122ada7a0ff707c (patch) | |
tree | 9b949cce3f111c41478b6bbe404b7fdf525ef45f /arch/x86 | |
parent | 1cc9629402b1eba0d4e21b2cc43eec9bd737f9bd (diff) | |
parent | b945d6b2554d550fe95caadc61e521c0ad71fb9c (diff) |
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
rbtree: Undo augmented trees performance damage and regression
x86, Calgary: Limit the max PHB number to 256
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/pci-calgary_64.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/pat_rbtree.c | 34 |
2 files changed, 7 insertions, 31 deletions
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 0b96b5589f08..078d4ec1a9d9 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c | |||
@@ -110,7 +110,7 @@ int use_calgary __read_mostly = 0; | |||
110 | * x3950 (PCIE): 8 chassis, 32 PHBs per chassis = 256 | 110 | * x3950 (PCIE): 8 chassis, 32 PHBs per chassis = 256 |
111 | * x3950 (PCIX): 8 chassis, 16 PHBs per chassis = 128 | 111 | * x3950 (PCIX): 8 chassis, 16 PHBs per chassis = 128 |
112 | */ | 112 | */ |
113 | #define MAX_PHB_BUS_NUM 384 | 113 | #define MAX_PHB_BUS_NUM 256 |
114 | 114 | ||
115 | #define PHBS_PER_CALGARY 4 | 115 | #define PHBS_PER_CALGARY 4 |
116 | 116 | ||
@@ -1056,8 +1056,6 @@ static int __init calgary_init_one(struct pci_dev *dev) | |||
1056 | struct iommu_table *tbl; | 1056 | struct iommu_table *tbl; |
1057 | int ret; | 1057 | int ret; |
1058 | 1058 | ||
1059 | BUG_ON(dev->bus->number >= MAX_PHB_BUS_NUM); | ||
1060 | |||
1061 | bbar = busno_to_bbar(dev->bus->number); | 1059 | bbar = busno_to_bbar(dev->bus->number); |
1062 | ret = calgary_setup_tar(dev, bbar); | 1060 | ret = calgary_setup_tar(dev, bbar); |
1063 | if (ret) | 1061 | if (ret) |
diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c index f20eeec85a86..8acaddd0fb21 100644 --- a/arch/x86/mm/pat_rbtree.c +++ b/arch/x86/mm/pat_rbtree.c | |||
@@ -34,8 +34,7 @@ | |||
34 | * memtype_lock protects the rbtree. | 34 | * memtype_lock protects the rbtree. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | static void memtype_rb_augment_cb(struct rb_node *node); | 37 | static struct rb_root memtype_rbroot = RB_ROOT; |
38 | static struct rb_root memtype_rbroot = RB_AUGMENT_ROOT(&memtype_rb_augment_cb); | ||
39 | 38 | ||
40 | static int is_node_overlap(struct memtype *node, u64 start, u64 end) | 39 | static int is_node_overlap(struct memtype *node, u64 start, u64 end) |
41 | { | 40 | { |
@@ -56,7 +55,7 @@ static u64 get_subtree_max_end(struct rb_node *node) | |||
56 | } | 55 | } |
57 | 56 | ||
58 | /* Update 'subtree_max_end' for a node, based on node and its children */ | 57 | /* Update 'subtree_max_end' for a node, based on node and its children */ |
59 | static void update_node_max_end(struct rb_node *node) | 58 | static void memtype_rb_augment_cb(struct rb_node *node, void *__unused) |
60 | { | 59 | { |
61 | struct memtype *data; | 60 | struct memtype *data; |
62 | u64 max_end, child_max_end; | 61 | u64 max_end, child_max_end; |
@@ -78,25 +77,6 @@ static void update_node_max_end(struct rb_node *node) | |||
78 | data->subtree_max_end = max_end; | 77 | data->subtree_max_end = max_end; |
79 | } | 78 | } |
80 | 79 | ||
81 | /* Update 'subtree_max_end' for a node and all its ancestors */ | ||
82 | static void update_path_max_end(struct rb_node *node) | ||
83 | { | ||
84 | u64 old_max_end, new_max_end; | ||
85 | |||
86 | while (node) { | ||
87 | struct memtype *data = container_of(node, struct memtype, rb); | ||
88 | |||
89 | old_max_end = data->subtree_max_end; | ||
90 | update_node_max_end(node); | ||
91 | new_max_end = data->subtree_max_end; | ||
92 | |||
93 | if (new_max_end == old_max_end) | ||
94 | break; | ||
95 | |||
96 | node = rb_parent(node); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | /* Find the first (lowest start addr) overlapping range from rb tree */ | 80 | /* Find the first (lowest start addr) overlapping range from rb tree */ |
101 | static struct memtype *memtype_rb_lowest_match(struct rb_root *root, | 81 | static struct memtype *memtype_rb_lowest_match(struct rb_root *root, |
102 | u64 start, u64 end) | 82 | u64 start, u64 end) |
@@ -190,12 +170,6 @@ failure: | |||
190 | return -EBUSY; | 170 | return -EBUSY; |
191 | } | 171 | } |
192 | 172 | ||
193 | static void memtype_rb_augment_cb(struct rb_node *node) | ||
194 | { | ||
195 | if (node) | ||
196 | update_path_max_end(node); | ||
197 | } | ||
198 | |||
199 | static void memtype_rb_insert(struct rb_root *root, struct memtype *newdata) | 173 | static void memtype_rb_insert(struct rb_root *root, struct memtype *newdata) |
200 | { | 174 | { |
201 | struct rb_node **node = &(root->rb_node); | 175 | struct rb_node **node = &(root->rb_node); |
@@ -213,6 +187,7 @@ static void memtype_rb_insert(struct rb_root *root, struct memtype *newdata) | |||
213 | 187 | ||
214 | rb_link_node(&newdata->rb, parent, node); | 188 | rb_link_node(&newdata->rb, parent, node); |
215 | rb_insert_color(&newdata->rb, root); | 189 | rb_insert_color(&newdata->rb, root); |
190 | rb_augment_insert(&newdata->rb, memtype_rb_augment_cb, NULL); | ||
216 | } | 191 | } |
217 | 192 | ||
218 | int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type) | 193 | int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type) |
@@ -234,13 +209,16 @@ int rbt_memtype_check_insert(struct memtype *new, unsigned long *ret_type) | |||
234 | 209 | ||
235 | struct memtype *rbt_memtype_erase(u64 start, u64 end) | 210 | struct memtype *rbt_memtype_erase(u64 start, u64 end) |
236 | { | 211 | { |
212 | struct rb_node *deepest; | ||
237 | struct memtype *data; | 213 | struct memtype *data; |
238 | 214 | ||
239 | data = memtype_rb_exact_match(&memtype_rbroot, start, end); | 215 | data = memtype_rb_exact_match(&memtype_rbroot, start, end); |
240 | if (!data) | 216 | if (!data) |
241 | goto out; | 217 | goto out; |
242 | 218 | ||
219 | deepest = rb_augment_erase_begin(&data->rb); | ||
243 | rb_erase(&data->rb, &memtype_rbroot); | 220 | rb_erase(&data->rb, &memtype_rbroot); |
221 | rb_augment_erase_end(deepest, memtype_rb_augment_cb, NULL); | ||
244 | out: | 222 | out: |
245 | return data; | 223 | return data; |
246 | } | 224 | } |