summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-04-07 05:45:16 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-18 04:15:12 -0400
commit486173a000ae7cebf6a3af7f95419544b5ecbd67 (patch)
tree996f21bc7d1ab39220d238ad1918b8c7de838d34 /drivers/gpu/nvgpu/include
parent26deb61b3b12c8f876133b78e64575d1478d0c95 (diff)
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 <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1457858 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/page_allocator.h13
1 files changed, 10 insertions, 3 deletions
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 @@
18#define PAGE_ALLOCATOR_PRIV_H 18#define PAGE_ALLOCATOR_PRIV_H
19 19
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/rbtree.h>
22 21
23#include <nvgpu/allocator.h> 22#include <nvgpu/allocator.h>
24#include <nvgpu/kmem.h> 23#include <nvgpu/kmem.h>
25#include <nvgpu/list.h> 24#include <nvgpu/list.h>
25#include <nvgpu/rbtree.h>
26 26
27struct nvgpu_allocator; 27struct nvgpu_allocator;
28 28
@@ -110,7 +110,7 @@ struct nvgpu_page_alloc {
110 */ 110 */
111 u64 base; 111 u64 base;
112 112
113 struct rb_node tree_entry; 113 struct nvgpu_rbtree_node tree_entry;
114 114
115 /* 115 /*
116 * Set if this is a slab alloc. Points back to the slab page that owns 116 * Set if this is a slab alloc. Points back to the slab page that owns
@@ -120,6 +120,13 @@ struct nvgpu_page_alloc {
120 struct page_alloc_slab_page *slab_page; 120 struct page_alloc_slab_page *slab_page;
121}; 121};
122 122
123static inline struct nvgpu_page_alloc *
124nvgpu_page_alloc_from_rbtree_node(struct nvgpu_rbtree_node *node)
125{
126 return (struct nvgpu_page_alloc *)
127 ((uintptr_t)node - offsetof(struct nvgpu_page_alloc, tree_entry));
128};
129
123struct nvgpu_page_allocator { 130struct nvgpu_page_allocator {
124 struct nvgpu_allocator *owner; /* Owner of this allocator. */ 131 struct nvgpu_allocator *owner; /* Owner of this allocator. */
125 132
@@ -138,7 +145,7 @@ struct nvgpu_page_allocator {
138 u64 page_size; 145 u64 page_size;
139 u32 page_shift; 146 u32 page_shift;
140 147
141 struct rb_root allocs; /* Outstanding allocations. */ 148 struct nvgpu_rbtree_node *allocs; /* Outstanding allocations. */
142 149
143 struct page_alloc_slab *slabs; 150 struct page_alloc_slab *slabs;
144 int nr_slabs; 151 int nr_slabs;