From 6029684eb0e9d2def2b0c12cbfba90c24b99369f Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Mon, 5 Sep 2016 14:58:23 +0300 Subject: gpu: nvgpu: fix chunk size mismatch in page allocator When allocating discontiguous memory composed of several chunks, update also the number of pages used by the current chunk, if a large chunk was not available and a retry is performed with a smaller one. Failing to do this would result in too few chunks reserved for a large enough allocation in certain conditions. Bug 1805067 Change-Id: I9d14864724d228b42c47eb4669fbe0f789334397 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/1214914 (cherry picked from commit 9bece931b13e4dad808622462d4d98d421cfb383) Reviewed-on: http://git-master/r/1220546 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c index 521a87b3..07e3d823 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator_page.c @@ -168,6 +168,8 @@ static struct gk20a_page_alloc *__gk20a_alloc_pages( } } while (!chunk_addr && chunk_len >= a->page_size); + chunk_pages = chunk_len >> a->page_shift; + if (!chunk_addr) { palloc_dbg(a, "bailing @ 0x%llx\n", chunk_len); goto fail_cleanup; -- cgit v1.2.2