函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\tracing_map.c Create Date:2022-07-27 13:14:05
Last Modify:2020-03-17 19:44:05 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__tracing_map_insert

函数原型:static inline struct tracing_map_elt *__tracing_map_insert(struct tracing_map *map, void *key, bool lookup_only)

返回类型:struct tracing_map_elt

参数:

类型参数名称
struct tracing_map *map
void *key
boollookup_only
516  dup_try等于0
520  key_hash等于jhash - hash an arbitrary key*@k: sequence of bytes as key*@length: the length of the key*@initval: the previous hash, or an arbitray value* The generic version, hashes an arbitrary sequence of bytes.
521  如果key_hash恒等于0则key_hash等于1
523  idx等于key_hash右移32减map_bits加1位
525  当1循环
526  idx与等于map_size减1
527  entry等于TRACING_MAP_ENTRY(map, idx)
528  test_key等于key
530  如果test_keytest_key恒等于key_hash
531  val等于READ_ONCE(val)
532  如果valkeys_match(key, key, key_size)则
534  如果非lookup_onlyatomic64_inc( & hits)
536  返回:val
550  dup_try自加
551  如果dup_try大于map_size
552  atomic64_inc( & drops)
553  退出
555  继续下一循环
559  如果非test_key
560  如果lookup_only退出
563  如果非cmpxchg( & key, 0, key_hash)则
566  elt等于get_free_elt(map)
567  如果非elt
568  atomic64_inc( & drops)
569  key等于0
570  退出
574  val等于elt
575  atomic64_inc( & hits)
577  返回:val
578  否则
583  dup_try自加
584  继续下一循环
588  idx自加
591  返回:NULL
调用者
名称描述
tracing_map_insertracing_map_insert - Insert key and/or retrieve val from a tracing_map*@map: The tracing_map to insert into*@key: The key to insert* Inserts a key into a tracing_map and creates and returns a new* tracing_map_elt for it, or if the key has already been
tracing_map_lookupracing_map_lookup - Retrieve val from a tracing_map*@map: The tracing_map to perform the lookup on*@key: The key to look up* Looks up key in tracing_map and if found returns the matching* tracing_map_elt. This is a lock-free lookup; see