1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
From 7f516b0ee139edb309654861d744e063a33c9331 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Thu, 26 Apr 2018 15:11:48 -0400
Subject: [PATCH 5670/5725] drm/amdkfd: Simplify obj handle allocation
MIN and MAX_IDR_IDs aren't necessary because the entire ID range is
fine for this purpose, including 0.
Don't use the idr_preload functionality. This is meant for situations
where an ID allocation is done in a place where it cannot fail. Then
idr_preload can be done in a place where it's still OK to fail. Here
both are in the same place, so it's not necessary to preload the memory
allocation.
Change-Id: I484657cd43904b546a5c605b766955925068ff99
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_process.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 13fd54a..182bf1c 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -60,9 +60,6 @@ static struct workqueue_struct *kfd_process_wq;
*/
static struct workqueue_struct *kfd_restore_wq;
-#define MIN_IDR_ID 1
-#define MAX_IDR_ID 0 /*0 - for unlimited*/
-
static struct kfd_process *find_process(const struct task_struct *thread,
bool ref);
static void kfd_process_ref_release(struct kref *ref);
@@ -843,12 +840,7 @@ int kfd_process_device_create_obj_handle(struct kfd_process_device *pdd,
INIT_LIST_HEAD(&buf_obj->cb_data_head);
- idr_preload(GFP_KERNEL);
-
- handle = idr_alloc(&pdd->alloc_idr, buf_obj, MIN_IDR_ID, MAX_IDR_ID,
- GFP_NOWAIT);
-
- idr_preload_end();
+ handle = idr_alloc(&pdd->alloc_idr, buf_obj, 0, 0, GFP_KERNEL);
if (handle < 0)
kfree(buf_obj);
--
2.7.4
|