summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-04-07 06:02:40 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-18 04:15:12 -0400
commite65893db0c4a8e9918c2d78af755d74906d43409 (patch)
treefad24cfb87c86e278f4dcf7b766dc2fd255764b0 /drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h
parent486173a000ae7cebf6a3af7f95419544b5ecbd67 (diff)
gpu: nvgpu: use nvgpu rbtree for bitmap allocator
Use nvgpu rbtree instead of linux rbtree for bitmap allocator Move to use nvgpu_rbtree_node structure and nvgpu_rbtree_* APIs Jira NVGPU-13 Change-Id: I25543cd737ed16728a67b42f70c4d233b8cc2a63 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1457859 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h')
-rw-r--r--drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h b/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h
index 95780202..4f0b3012 100644
--- a/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h
+++ b/drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h
@@ -17,8 +17,8 @@
17#ifndef BITMAP_ALLOCATOR_PRIV_H 17#ifndef BITMAP_ALLOCATOR_PRIV_H
18#define BITMAP_ALLOCATOR_PRIV_H 18#define BITMAP_ALLOCATOR_PRIV_H
19 19
20#include <linux/rbtree.h>
21 20
21#include <nvgpu/rbtree.h>
22#include <nvgpu/kmem.h> 22#include <nvgpu/kmem.h>
23 23
24struct nvgpu_allocator; 24struct nvgpu_allocator;
@@ -43,7 +43,7 @@ struct nvgpu_bitmap_allocator {
43 u64 next_blk; 43 u64 next_blk;
44 44
45 unsigned long *bitmap; /* The actual bitmap! */ 45 unsigned long *bitmap; /* The actual bitmap! */
46 struct rb_root allocs; /* Tree of outstanding allocations. */ 46 struct nvgpu_rbtree_node *allocs; /* Tree of outstanding allocations */
47 47
48 struct nvgpu_kmem_cache *meta_data_cache; 48 struct nvgpu_kmem_cache *meta_data_cache;
49 49
@@ -61,7 +61,14 @@ struct nvgpu_bitmap_allocator {
61struct nvgpu_bitmap_alloc { 61struct nvgpu_bitmap_alloc {
62 u64 base; 62 u64 base;
63 u64 length; 63 u64 length;
64 struct rb_node alloc_entry; /* RB tree of allocations. */ 64 struct nvgpu_rbtree_node alloc_entry; /* RB tree of allocations. */
65};
66
67static inline struct nvgpu_bitmap_alloc *
68nvgpu_bitmap_alloc_from_rbtree_node(struct nvgpu_rbtree_node *node)
69{
70 return (struct nvgpu_bitmap_alloc *)
71 ((uintptr_t)node - offsetof(struct nvgpu_bitmap_alloc, alloc_entry));
65}; 72};
66 73
67static inline struct nvgpu_bitmap_allocator *bitmap_allocator( 74static inline struct nvgpu_bitmap_allocator *bitmap_allocator(