From e65893db0c4a8e9918c2d78af755d74906d43409 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 7 Apr 2017 15:32:40 +0530 Subject: 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 Reviewed-on: http://git-master/r/1457859 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani --- drivers/gpu/nvgpu/common/mm/bitmap_allocator_priv.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (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 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 @@ #ifndef BITMAP_ALLOCATOR_PRIV_H #define BITMAP_ALLOCATOR_PRIV_H -#include +#include #include struct nvgpu_allocator; @@ -43,7 +43,7 @@ struct nvgpu_bitmap_allocator { u64 next_blk; unsigned long *bitmap; /* The actual bitmap! */ - struct rb_root allocs; /* Tree of outstanding allocations. */ + struct nvgpu_rbtree_node *allocs; /* Tree of outstanding allocations */ struct nvgpu_kmem_cache *meta_data_cache; @@ -61,7 +61,14 @@ struct nvgpu_bitmap_allocator { struct nvgpu_bitmap_alloc { u64 base; u64 length; - struct rb_node alloc_entry; /* RB tree of allocations. */ + struct nvgpu_rbtree_node alloc_entry; /* RB tree of allocations. */ +}; + +static inline struct nvgpu_bitmap_alloc * +nvgpu_bitmap_alloc_from_rbtree_node(struct nvgpu_rbtree_node *node) +{ + return (struct nvgpu_bitmap_alloc *) + ((uintptr_t)node - offsetof(struct nvgpu_bitmap_alloc, alloc_entry)); }; static inline struct nvgpu_bitmap_allocator *bitmap_allocator( -- cgit v1.2.2