mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
gpu: nvgpu: remove blocking wait for vidmem allocation
We have blocking 1sec wait for vidmem allocation Remove this blocking wait and just return proper error code to the caller In case we have some buffers to be cleaned up in the list (clear_list_head), return EAGAIN so that caller can retry Otherwise return ENOMEM indicating that no memory is available right now Jira DNVGPU-84 Change-Id: Ife2b17c989fc80e568f03bb18ad75b93a25be962 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1204969 (cherry picked from commit 2bacdf0bc6d5b1cdcb8be37e574ca5f4f0663cae) Reviewed-on: http://git-master/r/1213451 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
dc3976e4c3
commit
f31e575ed6
@@ -2981,7 +2981,7 @@ int gk20a_gmmu_alloc_attr_vid_at(struct gk20a *g, enum dma_attr attr,
|
||||
#if defined(CONFIG_GK20A_VIDMEM)
|
||||
u64 addr;
|
||||
int err;
|
||||
unsigned long end_jiffies = jiffies + msecs_to_jiffies(1000);
|
||||
bool clear_list_empty;
|
||||
struct gk20a_allocator *vidmem_alloc = g->mm.vidmem.cleared ?
|
||||
&g->mm.vidmem.allocator :
|
||||
&g->mm.vidmem.bootstrap_allocator;
|
||||
@@ -2995,16 +2995,17 @@ int gk20a_gmmu_alloc_attr_vid_at(struct gk20a *g, enum dma_attr attr,
|
||||
* are not done anyway */
|
||||
WARN_ON(attr != 0 && attr != DMA_ATTR_NO_KERNEL_MAPPING);
|
||||
|
||||
do {
|
||||
addr = __gk20a_gmmu_alloc(vidmem_alloc, at, size);
|
||||
if (!addr) /* Possible OOM */
|
||||
usleep_range(100, 300);
|
||||
else
|
||||
break;
|
||||
} while (time_before(jiffies, end_jiffies));
|
||||
addr = __gk20a_gmmu_alloc(vidmem_alloc, at, size);
|
||||
if (!addr) {
|
||||
mutex_lock(&g->mm.vidmem.clear_list_mutex);
|
||||
clear_list_empty = list_empty(&g->mm.vidmem.clear_list_head);
|
||||
mutex_unlock(&g->mm.vidmem.clear_list_mutex);
|
||||
|
||||
if (!addr)
|
||||
return -ENOMEM;
|
||||
if (clear_list_empty)
|
||||
return -ENOMEM;
|
||||
else
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
if (at)
|
||||
mem->fixed = true;
|
||||
|
||||
Reference in New Issue
Block a user