summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2016-06-22 18:53:35 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-06-23 16:02:19 -0400
commitdf1ff34809756aba22957e19cb39c205f271f856 (patch)
tree6d2e3dc0d62cf17d6aa904a441caebb6e4f4c8ce /drivers
parent2c04ddcdf6adce0f7430cc42fd09475973d1c62c (diff)
gpu: nvgpu: Compute reasonable max order for allocator
Compute a reasonable maximum order for buddy allocators that are created with a max_order of 0. Previously the max_order was just left as 0. Change-Id: I5c2f878fcd390610a4c02ac65189138ec7db30c8 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1169763 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_allocator.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
index 2b351492..fd721709 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_allocator.c
@@ -90,6 +90,11 @@ static void balloc_compute_max_order(struct gk20a_allocator *a)
90{ 90{
91 u64 true_max_order = ilog2(a->blks); 91 u64 true_max_order = ilog2(a->blks);
92 92
93 if (a->max_order == 0) {
94 a->max_order = true_max_order;
95 return;
96 }
97
93 if (a->max_order > true_max_order) 98 if (a->max_order > true_max_order)
94 a->max_order = true_max_order; 99 a->max_order = true_max_order;
95 if (a->max_order > GPU_BALLOC_MAX_ORDER) 100 if (a->max_order > GPU_BALLOC_MAX_ORDER)