3 #include <linux/bitmap.h> 16 struct rb_node **p = &root->rb_node;
30 rb_link_node(&entry->
rb_node, parent, p);
31 rb_insert_color(&entry->
rb_node, root);
38 entry->
end = start + bsize;
48 int i, j = 0, max = 0;
50 memset(map, 0x0,
sizeof(*map));
55 max += bitmap_weight(n->
set, n->
size);
58 entries =
zalloc(
sizeof(*entries) * max);
67 for (bit = 0; bit < n->
size; bit++) {
70 if (!test_bit(bit, n->
set))
82 if ((prev->
end == start) &&
94 tmp_entries = realloc(entries,
sizeof(*entries) * j);
96 entries = tmp_entries;
98 for (i = 0; i < j; i++) {
99 pr_debug(
"mem2node %03" PRIu64
" [0x%016" PRIx64
"-0x%016" PRIx64
"]\n",
116 struct rb_node **p, *parent = NULL;
119 p = &map->
root.rb_node;
123 if (addr < entry->
start)
125 else if (addr >= entry->
end)
133 return entry ? (int) entry->
node : -1;
int mem2node__node(struct mem2node *map, u64 addr)
void mem2node__exit(struct mem2node *map)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
static void phys_entry__init(struct phys_entry *entry, u64 start, u64 bsize, u64 node)
struct phys_entry * entries
unsigned long long memory_bsize
#define pr_debug(fmt,...)
static int entry(u64 ip, struct unwind_info *ui)
static void phys_entry__insert(struct phys_entry *entry, struct rb_root *root)
struct memory_node * memory_nodes
int mem2node__init(struct mem2node *map, struct perf_env *env)
void static void * zalloc(size_t size)