gpu: nvgpu: Check for split_order > max_order

When choosing an order of buddy to start splitting from (happens when
no buddies of the requested alloc order exist) don't sit in the while
loop past max_order. This makes no sense and hangs the system.

Bug 1647902

Change-Id: I6900597d24944d3170bc76cd75f33794b07707d1
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/756591
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Alex Waterman
2015-06-10 13:53:23 -07:00
committed by Terje Bergstrom
parent 0035aff307
commit ed776185ec

View File

@@ -604,10 +604,11 @@ static struct gk20a_buddy *__balloc_find_buddy(struct gk20a_allocator *a,
static u64 __balloc_do_alloc(struct gk20a_allocator *a, u64 order, int pte_size)
{
u64 split_order;
struct gk20a_buddy *bud;
struct gk20a_buddy *bud = NULL;
split_order = order;
while (!(bud = __balloc_find_buddy(a, split_order, pte_size)))
while (split_order <= a->max_order &&
!(bud = __balloc_find_buddy(a, split_order, pte_size)))
split_order++;
/* Out of memory! */