Re: %u-order allocation failed

From: Mikulas Patocka (mikulas@artax.karlin.mff.cuni.cz)
Date: Sat Oct 06 2001 - 14:05:55 EST


> This is enhanced version of a patch that fixes select and poll as well.
> Again - not compiled, not tried.

There is a bug that it does not align allocation - so things like
(%esp & ~8191) won't work. This should be applied on the top of it.

Mikulas


--- linux-orig/mm/vmalloc.c Sat Oct 6 16:21:47 2001
+++ linux/mm/vmalloc.c Sat Oct 6 21:01:00 2001
@@ -170,6 +170,9 @@
 {
         unsigned long addr;
         struct vm_struct **p, *tmp, *area;
+ int align = 0;
+
+ if (size > PAGE_SIZE && !(size & (size - 1))) align = size - 1;
 
         area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
         if (!area)
@@ -183,6 +186,7 @@
                 if (size + addr <= (unsigned long) tmp->addr)
                         break;
                 addr = tmp->size + (unsigned long) tmp->addr;
+ addr = (addr + align) & ~align;
                 if (addr > VMALLOC_END-size)
                         goto out;
         }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Oct 07 2001 - 21:00:42 EST