summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/kmem_priv.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/kmem_priv.h')
-rw-r--r--drivers/gpu/nvgpu/common/linux/kmem_priv.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/kmem_priv.h b/drivers/gpu/nvgpu/common/linux/kmem_priv.h
index 5e38ad5d..cd58ac28 100644
--- a/drivers/gpu/nvgpu/common/linux/kmem_priv.h
+++ b/drivers/gpu/nvgpu/common/linux/kmem_priv.h
@@ -17,7 +17,7 @@
17#ifndef __KMEM_PRIV_H__ 17#ifndef __KMEM_PRIV_H__
18#define __KMEM_PRIV_H__ 18#define __KMEM_PRIV_H__
19 19
20#include <linux/rbtree.h> 20#include <nvgpu/rbtree.h>
21 21
22#define __pstat(s, fmt, msg...) \ 22#define __pstat(s, fmt, msg...) \
23 do { \ 23 do { \
@@ -61,8 +61,14 @@ struct nvgpu_mem_alloc {
61 unsigned long size; 61 unsigned long size;
62 unsigned long real_size; 62 unsigned long real_size;
63 63
64 /* Ugh - linux specific. Will need to be abstracted. */ 64 struct nvgpu_rbtree_node allocs_entry;
65 struct rb_node allocs_entry; 65};
66
67static inline struct nvgpu_mem_alloc *
68nvgpu_mem_alloc_from_rbtree_node(struct nvgpu_rbtree_node *node)
69{
70 return (struct nvgpu_mem_alloc *)
71 ((uintptr_t)node - offsetof(struct nvgpu_mem_alloc, allocs_entry));
66}; 72};
67 73
68/* 74/*
@@ -71,7 +77,7 @@ struct nvgpu_mem_alloc {
71struct nvgpu_mem_alloc_tracker { 77struct nvgpu_mem_alloc_tracker {
72 const char *name; 78 const char *name;
73 struct nvgpu_kmem_cache *allocs_cache; 79 struct nvgpu_kmem_cache *allocs_cache;
74 struct rb_root allocs; 80 struct nvgpu_rbtree_node *allocs;
75 struct mutex lock; 81 struct mutex lock;
76 82
77 u64 bytes_alloced; 83 u64 bytes_alloced;