On Thu, Jun 21, 2012 at 05:57:11PM -0400, Rik van Riel wrote: > /* Is this gap large enough? Remember it. */ > vma_start = max(vma->vm_prev->vm_end, lower_limit); > + vma_start = arch_align_addr(vma_start, filp, > + pgoff, flags, ALLOC_UP); > if (vma->vm_start - len >= vma_start) { > addr = vma_start; > found_here = true; So, right there you're losing the benefit of O(log N) allocations on these vmas that require alignment. The rbtree lets you quickly find an allocation that has the desired size, but you may see any number of them without ever finding one that is large enough after alignment. I wonder if one could go with a two-stage process: 1- figure out what gap size would guarantee a successful, aligned allocation. basically it's desired size + desired alignment - PAGE_SIZE. See if you can find a gap of that size, and carve your aligned allocation into it if possible. 2- if that failed, look for all gaps of at least the desired size, as you are proposing, and see if any of them is aligned enough for your requirements. This would possibly cause a bit more virtual address space fragmentation, but I think this should still work ? -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>