From 93f6fdbe3123fc4b3c0b64743b47511ac35ca9f0 Mon Sep 17 00:00:00 2001 From: Pranav Patel Date: Tue, 17 May 2022 20:05:53 +0530 Subject: [PATCH] msm: kgsl: use kvmalloc for ringbuffer submission kmalloc returns out of memory in low memory conditions even if memory is available in non-contiguous manner. This results in failure to submit commands to ringbuffer. Use kvmalloc in place of kmalloc so that when kmalloc fails in low memory conditions, commands can be submitted if vmalloc can provide enough memory. Change-Id: If6a20e35983982b5c0888e5f7dabecfa8c026bcb Signed-off-by: Pranav Patel --- drivers/gpu/msm/adreno_ringbuffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/msm/adreno_ringbuffer.c b/drivers/gpu/msm/adreno_ringbuffer.c index 0e25e7bfcf81..1aa6777f8248 100644 --- a/drivers/gpu/msm/adreno_ringbuffer.c +++ b/drivers/gpu/msm/adreno_ringbuffer.c @@ -996,7 +996,7 @@ int adreno_ringbuffer_submitcmd(struct adreno_device *adreno_dev, if (gpudev->ccu_invalidate) dwords += 4; - link = kcalloc(dwords, sizeof(unsigned int), GFP_KERNEL); + link = kvcalloc(dwords, sizeof(unsigned int), GFP_KERNEL); if (!link) { ret = -ENOMEM; goto done; @@ -1129,7 +1129,7 @@ done: trace_kgsl_issueibcmds(device, context->id, numibs, drawobj->timestamp, drawobj->flags, ret, drawctxt->type); - kfree(link); + kvfree(link); return ret; }