函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:include\linux\rhashtable.h Create Date:2022-07-27 07:05:12
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Internal function, please use rhashtable_insert_fast() instead. This* function returns the existing element already in hashes in there is a clash,* otherwise it returns an error via ERR_PTR().

函数原型:static inline void *__rhashtable_insert_fast(struct rhashtable *ht, const void *key, struct rhash_head *obj, const struct rhashtable_params params, bool rhlist)

返回类型:void

参数:

类型参数名称
struct rhashtable *ht
const void *key
struct rhash_head *obj
const struct rhashtable_paramsparams
boolrhlist
708  struct rhashtable_compare_arg arg = {ht = ht, key = key, }
713  __rcupprev
720  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
722  tbl等于rht_dereference_rcu(tbl, ht)
723  hash等于rht_head_hashfn(ht, tbl, obj, params)
724  elasticity等于Maximum chain length before rehash* The maximum (not average) chain length grows with the size of the hash* table, at a rate of (log N)/(log log N)
725  bkt等于rht_bucket_insert(ht, tbl, hash)
726  data等于错误号
727  如果非bkt则转到:out
729  pprev = NULL
730  We lock a bucket by setting BIT(0) in the pointer - this is always* zero in real pointers. The NULLS mark is never stored in the bucket,* rather we store NULL if the bucket is empty.* bit_spin_locks do not handle contention well, but the whole point
732  如果此条件成立可能性小(为编译器优化)(cu_access_pointer() - fetch RCU pointer with no dereferencing*@p: The pointer to read* Return the value of the specified RCU-protected pointer, but omit the* lockdep checks for being in an RCU read-side critical section(future_tbl))则
733  slow_path :
734  rht_unlock(tbl, bkt)
735  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
736  返回:rhashtable_insert_slow(ht, key, obj)
743  elasticity自减
744  如果非key或如果obj_cmpfnobj_cmpfn( & arg, rht_obj(ht, head))否则rhashtable_compare( & arg, rht_obj(ht, head))则
748  pprev等于next
749  继续下一循环
752  data等于rht_obj(ht, head)
754  如果非rhlist则转到:out_unlock
758  list等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(obj, structrhlist_head, rhead)
759  plist等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(head, structrhlist_head, rhead)
761  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers(next, plist)
762  head等于rht_dereference_bucket(next, tbl, hash)
763  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers(next, head)
764  如果pprev
766  rht_unlock(tbl, bkt)
767  否则rht_assign_unlock(tbl, bkt, obj)
769  data = NULL
770  转到:out
773  如果elasticity小于等于0则转到:slow_path
776  data等于错误号
777  如果此条件成立可能性小(为编译器优化)(表溢出)则转到:out_unlock
780  如果此条件成立可能性小(为编译器优化)(ht_grow_above_100 - returns true if nelems > table-size*@ht: hash table*@tbl: current table)则转到:slow_path
784  head等于rht_ptr(bkt, tbl, hash)
786  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers(next, head)
787  如果rhlist
790  list等于container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(obj, structrhlist_head, rhead)
791  RCU_INIT_POINTER() - initialize an RCU protected pointer*@p: The pointer to be initialized.*@v: The value to initialized the pointer to.* Initialize an RCU-protected pointer in special cases where readers(next, NULL)
794  atomic_inc( & nelems)
795  rht_assign_unlock(tbl, bkt, obj)
797  如果ht_grow_above_75 - returns true if nelems > 0.75 * table-size*@ht: hash table*@tbl: current tableschedule_work - put work task in global workqueue*@work: job to be done* Returns %false if @work was already on the kernel-global workqueue and* %true otherwise
800  data = NULL
801  out :
802  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
804  返回:data
806  out_unlock :
807  rht_unlock(tbl, bkt)
808  转到:out
调用者
名称描述
rhashtable_insert_fasthashtable_insert_fast - insert object into hash table*@ht: hash table*@obj: pointer to hash head inside object*@params: hash table parameters* Will take the per bucket bitlock to protect against mutual mutations* on the same bucket
rhltable_insert_keyhltable_insert_key - insert object into hash list table*@hlt: hash list table*@key: the pointer to the key*@list: pointer to hash list head inside object*@params: hash table parameters* Will take the per bucket bitlock to protect against mutual mutations
rhashtable_lookup_insert_fasthashtable_lookup_insert_fast - lookup and insert object into hash table*@ht: hash table*@obj: pointer to hash head inside object*@params: hash table parameters* This lookup function may only be used for fixed key hash table (key_len* parameter set)
rhashtable_lookup_get_insert_fasthashtable_lookup_get_insert_fast - lookup and insert object into hash table*@ht: hash table*@obj: pointer to hash head inside object*@params: hash table parameters* Just like rhashtable_lookup_insert_fast(), but this function returns the* object if it
rhashtable_lookup_insert_keyhashtable_lookup_insert_key - search and insert object to hash table* with explicit key*@ht: hash table*@key: key*@obj: pointer to hash head inside object*@params: hash table parameters* Lookups may occur in parallel with hashtable mutations and resizing
rhashtable_lookup_get_insert_keyhashtable_lookup_get_insert_key - lookup and insert object into hash table*@ht: hash table*@obj: pointer to hash head inside object*@params: hash table parameters*@data: pointer to element data already in hashes* Just like rhashtable_lookup_insert_key(),