summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/buddy_allocator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/buddy_allocator.c')
-rw-r--r--drivers/gpu/nvgpu/common/mm/buddy_allocator.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c
index b986b29f..5a0a28cb 100644
--- a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"), 5 * copy of this software and associated documentation files (the "Software"),
@@ -214,8 +214,9 @@ static int balloc_init_lists(struct nvgpu_buddy_allocator *a)
214 bend = a->end; 214 bend = a->end;
215 215
216 /* First make sure the LLs are valid. */ 216 /* First make sure the LLs are valid. */
217 for (i = 0; i < GPU_BALLOC_ORDER_LIST_LEN; i++) 217 for (i = 0; i < GPU_BALLOC_ORDER_LIST_LEN; i++) {
218 nvgpu_init_list_node(balloc_get_order_list(a, i)); 218 nvgpu_init_list_node(balloc_get_order_list(a, i));
219 }
219 220
220 while (bstart < bend) { 221 while (bstart < bend) {
221 order = __balloc_max_order_in(a, bstart, bend); 222 order = __balloc_max_order_in(a, bstart, bend);
@@ -505,8 +506,9 @@ static u64 __balloc_do_alloc(struct nvgpu_buddy_allocator *a,
505 506
506 split_order = order; 507 split_order = order;
507 while (split_order <= a->max_order && 508 while (split_order <= a->max_order &&
508 !(bud = __balloc_find_buddy(a, split_order, pte_size))) 509 !(bud = __balloc_find_buddy(a, split_order, pte_size))) {
509 split_order++; 510 split_order++;
511 }
510 512
511 /* Out of memory! */ 513 /* Out of memory! */
512 if (!bud) 514 if (!bud)
@@ -885,8 +887,9 @@ static u64 __nvgpu_balloc_fixed_buddy(struct nvgpu_allocator *__a,
885 balloc_alloc_fixed(a, falloc); 887 balloc_alloc_fixed(a, falloc);
886 888
887 nvgpu_list_for_each_entry(bud, &falloc->buddies, 889 nvgpu_list_for_each_entry(bud, &falloc->buddies,
888 nvgpu_buddy, buddy_entry) 890 nvgpu_buddy, buddy_entry) {
889 real_bytes += (bud->end - bud->start); 891 real_bytes += (bud->end - bud->start);
892 }
890 893
891 a->bytes_alloced += len; 894 a->bytes_alloced += len;
892 a->bytes_alloced_real += real_bytes; 895 a->bytes_alloced_real += real_bytes;