• Home
  • Raw
  • Download

Lines Matching refs:tbl

38 		       const struct bucket_table *tbl,  in head_hashfn()  argument
41 return rht_head_hashfn(ht, tbl, he, ht->p); in head_hashfn()
53 int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash) in lockdep_rht_bucket_is_held() argument
57 if (unlikely(tbl->nest)) in lockdep_rht_bucket_is_held()
59 return bit_spin_is_locked(0, (unsigned long *)&tbl->buckets[hash]); in lockdep_rht_bucket_is_held()
85 static void nested_bucket_table_free(const struct bucket_table *tbl) in nested_bucket_table_free() argument
87 unsigned int size = tbl->size >> tbl->nest; in nested_bucket_table_free()
88 unsigned int len = 1 << tbl->nest; in nested_bucket_table_free()
92 ntbl = (union nested_table *)rcu_dereference_raw(tbl->buckets[0]); in nested_bucket_table_free()
100 static void bucket_table_free(const struct bucket_table *tbl) in bucket_table_free() argument
102 if (tbl->nest) in bucket_table_free()
103 nested_bucket_table_free(tbl); in bucket_table_free()
105 kvfree(tbl); in bucket_table_free()
143 struct bucket_table *tbl; in nested_bucket_table_alloc() local
149 size = sizeof(*tbl) + sizeof(tbl->buckets[0]); in nested_bucket_table_alloc()
151 tbl = kzalloc(size, gfp); in nested_bucket_table_alloc()
152 if (!tbl) in nested_bucket_table_alloc()
155 if (!nested_table_alloc(ht, (union nested_table __rcu **)tbl->buckets, in nested_bucket_table_alloc()
157 kfree(tbl); in nested_bucket_table_alloc()
161 tbl->nest = (ilog2(nbuckets) - 1) % shift + 1; in nested_bucket_table_alloc()
163 return tbl; in nested_bucket_table_alloc()
170 struct bucket_table *tbl = NULL; in bucket_table_alloc() local
175 tbl = kvzalloc(struct_size(tbl, buckets, nbuckets), gfp); in bucket_table_alloc()
179 if (tbl == NULL && (gfp & ~__GFP_NOFAIL) != GFP_KERNEL) { in bucket_table_alloc()
180 tbl = nested_bucket_table_alloc(ht, nbuckets, gfp); in bucket_table_alloc()
184 if (tbl == NULL) in bucket_table_alloc()
187 lockdep_init_map(&tbl->dep_map, "rhashtable_bucket", &__key, 0); in bucket_table_alloc()
189 tbl->size = size; in bucket_table_alloc()
191 rcu_head_init(&tbl->rcu); in bucket_table_alloc()
192 INIT_LIST_HEAD(&tbl->walkers); in bucket_table_alloc()
194 tbl->hash_rnd = get_random_u32(); in bucket_table_alloc()
197 INIT_RHT_NULLS_HEAD(tbl->buckets[i]); in bucket_table_alloc()
199 return tbl; in bucket_table_alloc()
203 struct bucket_table *tbl) in rhashtable_last_table() argument
208 new_tbl = tbl; in rhashtable_last_table()
209 tbl = rht_dereference_rcu(tbl->future_tbl, ht); in rhashtable_last_table()
210 } while (tbl); in rhashtable_last_table()
219 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); in rhashtable_rehash_one()
268 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); in rhashtable_rehash_chain()
305 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); in rhashtable_rehash_table()
323 rcu_assign_pointer(ht->tbl, new_tbl); in rhashtable_rehash_table()
327 walker->tbl = NULL; in rhashtable_rehash_table()
380 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); in rhashtable_shrink()
401 struct bucket_table *tbl; in rht_deferred_worker() local
407 tbl = rht_dereference(ht->tbl, ht); in rht_deferred_worker()
408 tbl = rhashtable_last_table(ht, tbl); in rht_deferred_worker()
410 if (rht_grow_above_75(ht, tbl)) in rht_deferred_worker()
411 err = rhashtable_rehash_alloc(ht, tbl, tbl->size * 2); in rht_deferred_worker()
412 else if (ht->p.automatic_shrinking && rht_shrink_below_30(ht, tbl)) in rht_deferred_worker()
414 else if (tbl->nest) in rht_deferred_worker()
415 err = rhashtable_rehash_alloc(ht, tbl, tbl->size); in rht_deferred_worker()
431 struct bucket_table *tbl) in rhashtable_insert_rehash() argument
438 old_tbl = rht_dereference_rcu(ht->tbl, ht); in rhashtable_insert_rehash()
440 size = tbl->size; in rhashtable_insert_rehash()
444 if (rht_grow_above_75(ht, tbl)) in rhashtable_insert_rehash()
447 else if (old_tbl != tbl) in rhashtable_insert_rehash()
456 err = rhashtable_rehash_attach(ht, tbl, new_tbl); in rhashtable_insert_rehash()
468 if (likely(rcu_access_pointer(tbl->future_tbl))) in rhashtable_insert_rehash()
480 struct bucket_table *tbl, unsigned int hash, in rhashtable_lookup_one() argument
492 rht_for_each_from(head, rht_ptr(bkt, tbl, hash), tbl, hash) { in rhashtable_lookup_one()
512 head = rht_dereference_bucket(head->next, tbl, hash); in rhashtable_lookup_one()
531 struct bucket_table *tbl, in rhashtable_insert_one() argument
545 new_tbl = rht_dereference_rcu(tbl->future_tbl, ht); in rhashtable_insert_one()
552 if (unlikely(rht_grow_above_max(ht, tbl))) in rhashtable_insert_one()
555 if (unlikely(rht_grow_above_100(ht, tbl))) in rhashtable_insert_one()
558 head = rht_ptr(bkt, tbl, hash); in rhashtable_insert_one()
574 if (rht_grow_above_75(ht, tbl)) in rhashtable_insert_one()
584 struct bucket_table *tbl; in rhashtable_try_insert() local
589 new_tbl = rcu_dereference(ht->tbl); in rhashtable_try_insert()
592 tbl = new_tbl; in rhashtable_try_insert()
593 hash = rht_head_hashfn(ht, tbl, obj, ht->p); in rhashtable_try_insert()
594 if (rcu_access_pointer(tbl->future_tbl)) in rhashtable_try_insert()
596 bkt = rht_bucket_var(tbl, hash); in rhashtable_try_insert()
598 bkt = rht_bucket_insert(ht, tbl, hash); in rhashtable_try_insert()
600 new_tbl = rht_dereference_rcu(tbl->future_tbl, ht); in rhashtable_try_insert()
603 rht_lock(tbl, bkt); in rhashtable_try_insert()
604 data = rhashtable_lookup_one(ht, bkt, tbl, in rhashtable_try_insert()
606 new_tbl = rhashtable_insert_one(ht, bkt, tbl, in rhashtable_try_insert()
611 rht_unlock(tbl, bkt); in rhashtable_try_insert()
616 data = ERR_PTR(rhashtable_insert_rehash(ht, tbl) ?: in rhashtable_try_insert()
667 iter->walker.tbl = in rhashtable_walk_enter()
668 rcu_dereference_protected(ht->tbl, lockdep_is_held(&ht->lock)); in rhashtable_walk_enter()
669 list_add(&iter->walker.list, &iter->walker.tbl->walkers); in rhashtable_walk_enter()
683 if (iter->walker.tbl) in rhashtable_walk_exit()
716 if (iter->walker.tbl) in rhashtable_walk_start_check()
722 if (!iter->walker.tbl) { in rhashtable_walk_start_check()
723 iter->walker.tbl = rht_dereference_rcu(ht->tbl, ht); in rhashtable_walk_start_check()
736 rht_for_each_rcu(p, iter->walker.tbl, iter->slot) { in rhashtable_walk_start_check()
751 rht_for_each_rcu(p, iter->walker.tbl, iter->slot) { in rhashtable_walk_start_check()
782 struct bucket_table *tbl = iter->walker.tbl; in __rhashtable_walk_find_next() local
788 if (!tbl) in __rhashtable_walk_find_next()
791 for (; iter->slot < tbl->size; iter->slot++) { in __rhashtable_walk_find_next()
794 rht_for_each_rcu(p, tbl, iter->slot) { in __rhashtable_walk_find_next()
828 iter->walker.tbl = rht_dereference_rcu(tbl->future_tbl, ht); in __rhashtable_walk_find_next()
829 if (iter->walker.tbl) { in __rhashtable_walk_find_next()
927 struct bucket_table *tbl = iter->walker.tbl; in rhashtable_walk_stop() local
929 if (!tbl) in rhashtable_walk_stop()
935 if (rcu_head_after_call_rcu(&tbl->rcu, bucket_table_free_rcu)) in rhashtable_walk_stop()
937 iter->walker.tbl = NULL; in rhashtable_walk_stop()
939 list_add(&iter->walker.list, &tbl->walkers); in rhashtable_walk_stop()
1011 struct bucket_table *tbl; in rhashtable_init() local
1054 tbl = bucket_table_alloc(ht, size, GFP_KERNEL); in rhashtable_init()
1055 if (unlikely(tbl == NULL)) { in rhashtable_init()
1057 tbl = bucket_table_alloc(ht, size, GFP_KERNEL | __GFP_NOFAIL); in rhashtable_init()
1062 RCU_INIT_POINTER(ht->tbl, tbl); in rhashtable_init()
1127 struct bucket_table *tbl, *next_tbl; in rhashtable_free_and_destroy() local
1133 tbl = rht_dereference(ht->tbl, ht); in rhashtable_free_and_destroy()
1136 for (i = 0; i < tbl->size; i++) { in rhashtable_free_and_destroy()
1140 for (pos = rht_ptr_exclusive(rht_bucket(tbl, i)), in rhashtable_free_and_destroy()
1151 next_tbl = rht_dereference(tbl->future_tbl, ht); in rhashtable_free_and_destroy()
1152 bucket_table_free(tbl); in rhashtable_free_and_destroy()
1154 tbl = next_tbl; in rhashtable_free_and_destroy()
1167 struct rhash_lock_head **__rht_bucket_nested(const struct bucket_table *tbl, in __rht_bucket_nested() argument
1171 unsigned int index = hash & ((1 << tbl->nest) - 1); in __rht_bucket_nested()
1172 unsigned int size = tbl->size >> tbl->nest; in __rht_bucket_nested()
1176 ntbl = (union nested_table *)rcu_dereference_raw(tbl->buckets[0]); in __rht_bucket_nested()
1177 ntbl = rht_dereference_bucket_rcu(ntbl[index].table, tbl, hash); in __rht_bucket_nested()
1178 subhash >>= tbl->nest; in __rht_bucket_nested()
1183 tbl, hash); in __rht_bucket_nested()
1196 struct rhash_lock_head **rht_bucket_nested(const struct bucket_table *tbl, in rht_bucket_nested() argument
1203 return __rht_bucket_nested(tbl, hash) ?: &rhnull; in rht_bucket_nested()
1208 struct bucket_table *tbl, in rht_bucket_nested_insert() argument
1212 unsigned int index = hash & ((1 << tbl->nest) - 1); in rht_bucket_nested_insert()
1213 unsigned int size = tbl->size >> tbl->nest; in rht_bucket_nested_insert()
1216 ntbl = (union nested_table *)rcu_dereference_raw(tbl->buckets[0]); in rht_bucket_nested_insert()
1217 hash >>= tbl->nest; in rht_bucket_nested_insert()