Lines Matching full:table
9 return &threads->table[(unsigned int)tid % THREADS__TABLE_SIZE]; in threads__table()
14 /* The table lookup removes low bit entropy, but this is just ignored here. */ in key_hash()
26 struct threads_table_entry *table = &threads->table[i]; in threads__init() local
28 hashmap__init(&table->shard, key_hash, key_equal, NULL); in threads__init()
29 init_rwsem(&table->lock); in threads__init()
30 table->last_match = NULL; in threads__init()
38 struct threads_table_entry *table = &threads->table[i]; in threads__exit() local
40 hashmap__clear(&table->shard); in threads__exit()
41 exit_rwsem(&table->lock); in threads__exit()
50 struct threads_table_entry *table = &threads->table[i]; in threads__nr() local
52 down_read(&table->lock); in threads__nr()
53 nr += hashmap__size(&table->shard); in threads__nr()
54 up_read(&table->lock); in threads__nr()
64 static struct thread *__threads_table_entry__get_last_match(struct threads_table_entry *table, in __threads_table_entry__get_last_match() argument
69 th = table->last_match; in __threads_table_entry__get_last_match()
77 static void __threads_table_entry__set_last_match(struct threads_table_entry *table, in __threads_table_entry__set_last_match() argument
80 thread__put(table->last_match); in __threads_table_entry__set_last_match()
81 table->last_match = thread__get(th); in __threads_table_entry__set_last_match()
84 static void threads_table_entry__set_last_match(struct threads_table_entry *table, in threads_table_entry__set_last_match() argument
87 down_write(&table->lock); in threads_table_entry__set_last_match()
88 __threads_table_entry__set_last_match(table, th); in threads_table_entry__set_last_match()
89 up_write(&table->lock); in threads_table_entry__set_last_match()
94 struct threads_table_entry *table = threads__table(threads, tid); in threads__find() local
97 down_read(&table->lock); in threads__find()
98 res = __threads_table_entry__get_last_match(table, tid); in threads__find()
100 if (hashmap__find(&table->shard, tid, &res)) in threads__find()
103 up_read(&table->lock); in threads__find()
105 threads_table_entry__set_last_match(table, res); in threads__find()
111 struct threads_table_entry *table = threads__table(threads, tid); in threads__findnew() local
115 down_write(&table->lock); in threads__findnew()
118 if (hashmap__add(&table->shard, tid, res)) { in threads__findnew()
122 if (hashmap__find(&table->shard, tid, &res)) in threads__findnew()
129 __threads_table_entry__set_last_match(table, res); in threads__findnew()
131 up_write(&table->lock); in threads__findnew()
138 struct threads_table_entry *table = &threads->table[i]; in threads__remove_all_threads() local
142 down_write(&table->lock); in threads__remove_all_threads()
143 __threads_table_entry__set_last_match(table, NULL); in threads__remove_all_threads()
144 hashmap__for_each_entry_safe((&table->shard), cur, tmp, bkt) { in threads__remove_all_threads()
147 hashmap__delete(&table->shard, cur->key, /*old_key=*/NULL, &old_value); in threads__remove_all_threads()
150 up_write(&table->lock); in threads__remove_all_threads()
156 struct threads_table_entry *table = threads__table(threads, thread__tid(thread)); in threads__remove() local
159 down_write(&table->lock); in threads__remove()
160 if (table->last_match && RC_CHK_EQUAL(table->last_match, thread)) in threads__remove()
161 __threads_table_entry__set_last_match(table, NULL); in threads__remove()
163 hashmap__delete(&table->shard, thread__tid(thread), /*old_key=*/NULL, &old_value); in threads__remove()
165 up_write(&table->lock); in threads__remove()
173 struct threads_table_entry *table = &threads->table[i]; in threads__for_each_thread() local
177 down_read(&table->lock); in threads__for_each_thread()
178 hashmap__for_each_entry((&table->shard), cur, bkt) { in threads__for_each_thread()
182 up_read(&table->lock); in threads__for_each_thread()
186 up_read(&table->lock); in threads__for_each_thread()