2004-03-28 18:23:18

by Olof Johansson

[permalink] [raw]
Subject: [PATCH] ppc64: Fix thinko in iommu allocator

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 */