[PATCH] ppc64: Fix thinko in iommu allocator

From: Olof Johansson
Date: Sun Mar 28 2004 - 13:25:20 EST


Hi,

Below patch fixes a bug in the iommu allocator that causes it to behave
strangely when a fair size of the table is allocated.

Thanks to Andrew Gallatin for finding this.


-Olof

===== arch/ppc64/kernel/iommu.c 1.4 vs edited =====
--- 1.4/arch/ppc64/kernel/iommu.c Wed Mar 24 19:22:21 2004
+++ edited/arch/ppc64/kernel/iommu.c Thu Mar 25 17:37:04 2004
@@ -100,12 +100,13 @@
end = n + npages;

if (unlikely(end >= limit)) {
- if (likely(pass++ < 2)) {
+ if (likely(pass < 2)) {
/* First failure, just rescan the half of the table.
* Second failure, rescan the other half of the table.
*/
start = (largealloc ^ pass) ? tbl->it_halfpoint : 0;
limit = pass ? tbl->it_mapsize : limit;
+ pass++;
goto again;
} else {
/* Third failure, give up */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/