summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/lockless_allocator.c')
-rw-r--r--drivers/gpu/nvgpu/common/mm/lockless_allocator.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
index e3063a42..6fd9bc48 100644
--- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
@@ -20,6 +20,7 @@
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21 21
22#include <nvgpu/allocator.h> 22#include <nvgpu/allocator.h>
23#include <nvgpu/kmem.h>
23 24
24#include "lockless_allocator_priv.h" 25#include "lockless_allocator_priv.h"
25 26
@@ -106,7 +107,7 @@ static void nvgpu_lockless_alloc_destroy(struct nvgpu_allocator *a)
106 nvgpu_fini_alloc_debug(a); 107 nvgpu_fini_alloc_debug(a);
107 108
108 vfree(pa->next); 109 vfree(pa->next);
109 kfree(pa); 110 nvgpu_kfree(nvgpu_alloc_to_gpu(a), pa);
110} 111}
111 112
112static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a, 113static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a,
@@ -154,7 +155,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
154 return -EINVAL; 155 return -EINVAL;
155 156
156 /* 157 /*
157 * Ensure we have space for atleast one node & there's no overflow. 158 * Ensure we have space for at least one node & there's no overflow.
158 * In order to control memory footprint, we require count < INT_MAX 159 * In order to control memory footprint, we require count < INT_MAX
159 */ 160 */
160 count = length; 161 count = length;
@@ -162,11 +163,11 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
162 if (!base || !count || count > INT_MAX) 163 if (!base || !count || count > INT_MAX)
163 return -EINVAL; 164 return -EINVAL;
164 165
165 a = kzalloc(sizeof(struct nvgpu_lockless_allocator), GFP_KERNEL); 166 a = nvgpu_kzalloc(g, sizeof(struct nvgpu_lockless_allocator));
166 if (!a) 167 if (!a)
167 return -ENOMEM; 168 return -ENOMEM;
168 169
169 err = __nvgpu_alloc_common_init(__a, name, a, false, &pool_ops); 170 err = __nvgpu_alloc_common_init(__a, g, name, a, false, &pool_ops);
170 if (err) 171 if (err)
171 goto fail; 172 goto fail;
172 173
@@ -202,6 +203,6 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
202 return 0; 203 return 0;
203 204
204fail: 205fail:
205 kfree(a); 206 nvgpu_kfree(g, a);
206 return err; 207 return err;
207} 208}