From 6a48f4b3350f933b171edd4fac4a6860e53c2d64 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 10 Aug 2016 20:39:47 +0530 Subject: gpu: nvgpu: clear vidmem buffers in worker We clear buffers allocated in vidmem in buffer free path. But to clear buffers, we need to submit CE jobs and this could cause issues/races if free called from critical path Hence solve this by moving buffer clear/free to a worker gk20a_gmmu_free_attr_vid() will now just put mem_desc into a list and schedule a worker And worker thread will traverse the list and clear/free the allocations In struct gk20a_vidmem_buf, mem variable is statically allocated. But since we delay free of mem, convert this variable into a pointer and allocate it dynamically Since we delay free of vidmem memory, it is now possible to face OOM conditions during allocations. Hence while allocating block until we have sufficient memory available with an upper limit of 1S Jira DNVGPU-84 Change-Id: I7925590644afae50b6fc04c6e1e43bbaa1c220fd Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1201346 (cherry picked from commit b4dec4a30de2431369d677acca00e420f8e581a5) Reviewed-on: http://git-master/r/1210950 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index c6360955..54d3dfd0 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -71,6 +71,7 @@ struct mem_desc { size_t size; u64 gpu_va; bool fixed; /* vidmem only */ + struct list_head clear_list_entry; /* vidmem only */ }; struct mem_desc_sub { @@ -414,7 +415,11 @@ struct mm_gk20a { u32 ce_ctx_id; bool cleared; + + struct list_head clear_list_head; + struct mutex clear_list_mutex; } vidmem; + struct work_struct vidmem_clear_mem_worker; }; int gk20a_mm_init(struct mm_gk20a *mm); -- cgit v1.2.2