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.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
index 3eb10fc4..5f48d606 100644
--- a/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/lockless_allocator.c
@@ -73,7 +73,7 @@ static u64 nvgpu_lockless_alloc(struct nvgpu_allocator *a, u64 len)
73 if (ret == head) { 73 if (ret == head) {
74 addr = pa->base + head * pa->blk_size; 74 addr = pa->base + head * pa->blk_size;
75 nvgpu_atomic_inc(&pa->nr_allocs); 75 nvgpu_atomic_inc(&pa->nr_allocs);
76 alloc_dbg(a, "Alloc node # %d @ addr 0x%llx\n", head, 76 alloc_dbg(a, "Alloc node # %d @ addr 0x%llx", head,
77 addr); 77 addr);
78 break; 78 break;
79 } 79 }
@@ -81,9 +81,9 @@ static u64 nvgpu_lockless_alloc(struct nvgpu_allocator *a, u64 len)
81 } 81 }
82 82
83 if (addr) 83 if (addr)
84 alloc_dbg(a, "Alloc node # %d @ addr 0x%llx\n", head, addr); 84 alloc_dbg(a, "Alloc node # %d @ addr 0x%llx", head, addr);
85 else 85 else
86 alloc_dbg(a, "Alloc failed!\n"); 86 alloc_dbg(a, "Alloc failed!");
87 87
88 return addr; 88 return addr;
89} 89}
@@ -96,7 +96,7 @@ static void nvgpu_lockless_free(struct nvgpu_allocator *a, u64 addr)
96 96
97 cur_idx = (addr - pa->base) / pa->blk_size; 97 cur_idx = (addr - pa->base) / pa->blk_size;
98 98
99 alloc_dbg(a, "Free node # %llu @ addr 0x%llx\n", cur_idx, addr); 99 alloc_dbg(a, "Free node # %llu @ addr 0x%llx", cur_idx, addr);
100 100
101 while (1) { 101 while (1) {
102 head = NV_ACCESS_ONCE(pa->head); 102 head = NV_ACCESS_ONCE(pa->head);
@@ -104,7 +104,7 @@ static void nvgpu_lockless_free(struct nvgpu_allocator *a, u64 addr)
104 ret = cmpxchg(&pa->head, head, cur_idx); 104 ret = cmpxchg(&pa->head, head, cur_idx);
105 if (ret == head) { 105 if (ret == head) {
106 nvgpu_atomic_dec(&pa->nr_allocs); 106 nvgpu_atomic_dec(&pa->nr_allocs);
107 alloc_dbg(a, "Free node # %llu\n", cur_idx); 107 alloc_dbg(a, "Free node # %llu", cur_idx);
108 break; 108 break;
109 } 109 }
110 } 110 }
@@ -128,15 +128,15 @@ static void nvgpu_lockless_print_stats(struct nvgpu_allocator *a,
128{ 128{
129 struct nvgpu_lockless_allocator *pa = a->priv; 129 struct nvgpu_lockless_allocator *pa = a->priv;
130 130
131 __alloc_pstat(s, a, "Lockless allocator params:\n"); 131 __alloc_pstat(s, a, "Lockless allocator params:");
132 __alloc_pstat(s, a, " start = 0x%llx\n", pa->base); 132 __alloc_pstat(s, a, " start = 0x%llx", pa->base);
133 __alloc_pstat(s, a, " end = 0x%llx\n", pa->base + pa->length); 133 __alloc_pstat(s, a, " end = 0x%llx", pa->base + pa->length);
134 134
135 /* Actual stats. */ 135 /* Actual stats. */
136 __alloc_pstat(s, a, "Stats:\n"); 136 __alloc_pstat(s, a, "Stats:");
137 __alloc_pstat(s, a, " Number allocs = %d\n", 137 __alloc_pstat(s, a, " Number allocs = %d",
138 nvgpu_atomic_read(&pa->nr_allocs)); 138 nvgpu_atomic_read(&pa->nr_allocs));
139 __alloc_pstat(s, a, " Number free = %d\n", 139 __alloc_pstat(s, a, " Number free = %d",
140 pa->nr_nodes - nvgpu_atomic_read(&pa->nr_allocs)); 140 pa->nr_nodes - nvgpu_atomic_read(&pa->nr_allocs));
141} 141}
142#endif 142#endif
@@ -211,11 +211,11 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a,
211#ifdef CONFIG_DEBUG_FS 211#ifdef CONFIG_DEBUG_FS
212 nvgpu_init_alloc_debug(g, __a); 212 nvgpu_init_alloc_debug(g, __a);
213#endif 213#endif
214 alloc_dbg(__a, "New allocator: type lockless\n"); 214 alloc_dbg(__a, "New allocator: type lockless");
215 alloc_dbg(__a, " base 0x%llx\n", a->base); 215 alloc_dbg(__a, " base 0x%llx", a->base);
216 alloc_dbg(__a, " nodes %d\n", a->nr_nodes); 216 alloc_dbg(__a, " nodes %d", a->nr_nodes);
217 alloc_dbg(__a, " blk_size 0x%llx\n", a->blk_size); 217 alloc_dbg(__a, " blk_size 0x%llx", a->blk_size);
218 alloc_dbg(__a, " flags 0x%llx\n", a->flags); 218 alloc_dbg(__a, " flags 0x%llx", a->flags);
219 219
220 return 0; 220 return 0;
221 221