From cf0ef133e6e3075c808bb3f553b35e94fc000afd Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 4 Oct 2016 14:04:01 -0700 Subject: gpu: nvgpu: Move kmem_caches to allocator Instead of using a single static kmem_cache for each type of data structure the allocators may want to allocate each allocator now has its own instance of the kmem_cache. This is done so that each GPU driver instance can accurately track how much memory it is using. In order to support this on older kernels a new NVGPU API has been made, nvgpu_kmem_cache_create(struct gk20a *g, size_t size) To handle the possibility that caches cannot be created with the same name. This patch also fixes numerous places where kfree() was wrongly used to free kmem_cache allocs. Bug 1799159 Bug 1823380 Change-Id: Id674f9a5445fde3f95db65ad6bf3ea990444603d Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1283826 Reviewed-by: svccoveritychecker Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h') diff --git a/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h b/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h index 9802b9db..95780202 100644 --- a/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h +++ b/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -19,6 +19,8 @@ #include +#include + struct nvgpu_allocator; struct nvgpu_bitmap_allocator { @@ -43,6 +45,8 @@ struct nvgpu_bitmap_allocator { unsigned long *bitmap; /* The actual bitmap! */ struct rb_root allocs; /* Tree of outstanding allocations. */ + struct nvgpu_kmem_cache *meta_data_cache; + u64 flags; bool inited; -- cgit v1.2.2