From 486173a000ae7cebf6a3af7f95419544b5ecbd67 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 7 Apr 2017 15:15:16 +0530 Subject: gpu: nvgpu: use nvgpu rbtree for page allocator Use nvgpu rbtree instead of linux rbtree for page allocator Move to use nvgpu_rbtree_node structure and nvgpu_rbtree_* APIs Jira NVGPU-13 Change-Id: I3faf843762652c6005186cbe715377050f65ee2c Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1457858 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani --- drivers/gpu/nvgpu/include/nvgpu/page_allocator.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h b/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h index 92f48ac5..70ed81c3 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/page_allocator.h @@ -18,11 +18,11 @@ #define PAGE_ALLOCATOR_PRIV_H #include -#include #include #include #include +#include struct nvgpu_allocator; @@ -110,7 +110,7 @@ struct nvgpu_page_alloc { */ u64 base; - struct rb_node tree_entry; + struct nvgpu_rbtree_node tree_entry; /* * Set if this is a slab alloc. Points back to the slab page that owns @@ -120,6 +120,13 @@ struct nvgpu_page_alloc { struct page_alloc_slab_page *slab_page; }; +static inline struct nvgpu_page_alloc * +nvgpu_page_alloc_from_rbtree_node(struct nvgpu_rbtree_node *node) +{ + return (struct nvgpu_page_alloc *) + ((uintptr_t)node - offsetof(struct nvgpu_page_alloc, tree_entry)); +}; + struct nvgpu_page_allocator { struct nvgpu_allocator *owner; /* Owner of this allocator. */ @@ -138,7 +145,7 @@ struct nvgpu_page_allocator { u64 page_size; u32 page_shift; - struct rb_root allocs; /* Outstanding allocations. */ + struct nvgpu_rbtree_node *allocs; /* Outstanding allocations. */ struct page_alloc_slab *slabs; int nr_slabs; -- cgit v1.2.2