[PATCH 3/6] drm/amdgpu: allocate progressively higher ids for ctx until idr counter wraps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change-Id: I0e36d8b842a29b67afcc411330700238b428e746
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 963a14e..35761bd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -97,7 +97,8 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
 		return -ENOMEM;
 
 	mutex_lock(&amdgpu_ctx_lock);
-	r = idr_alloc(&amdgpu_ctx_idr, ctx, 1, 0, GFP_KERNEL);
+	/* allocate progressively higher ids until idr counter wraps */
+	r = idr_alloc_cyclic(&amdgpu_ctx_idr, ctx, 1, 0, GFP_KERNEL);
 	if (r < 0) {
 		mutex_unlock(&amdgpu_ctx_lock);
 		kfree(ctx);
-- 
1.9.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux