diff options
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/page_allocator.h | 13 |
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 | ||
27 | struct nvgpu_allocator; | 27 | struct 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 | ||
123 | static inline struct nvgpu_page_alloc * | ||
124 | nvgpu_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 | |||
123 | struct nvgpu_page_allocator { | 130 | struct 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; |