]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ti-linux-kernel/ti-linux-kernel-next.git/commit
iommu/dma: Avoid unlikely high-order allocations
authorRobin Murphy <robin.murphy@arm.com>
Fri, 18 Dec 2015 17:01:48 +0000 (17:01 +0000)
committerJoerg Roedel <jroedel@suse.de>
Mon, 28 Dec 2015 16:06:26 +0000 (17:06 +0100)
commit0a9afeda8057bcedc997278db193914d32c4003b
tree00815ca32b682f312fb40c12ba9ede8e7cfde363
parent5b11e9cd42d08e76b86eacf103b1fa7794e21bff
iommu/dma: Avoid unlikely high-order allocations

Doug reports that the equivalent page allocator on 32-bit ARM exhibits
particularly pathalogical behaviour under memory pressure when
fragmentation is high, where allocating a 4MB buffer takes tens of
seconds and the number of calls to alloc_pages() is over 9000![1]

We can drastically improve that situation without losing the other
benefits of high-order allocations when they would succeed, by assuming
memory pressure is relatively constant over the course of an allocation,
and not retrying allocations at orders we know to have failed before.
This way, the best-case behaviour remains unchanged, and in the worst
case we should see at most a dozen or so (MAX_ORDER - 1) failed attempts
before falling back to single pages for the remainder of the buffer.

[1]:http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/394660.html

Reported-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/dma-iommu.c