函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\test_rhashtable.c Create Date:2022-07-27 07:29:17
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:test_rht_init

函数原型:static int __init test_rht_init(void)

返回类型:int

参数:

699  started_threads等于0, failed_threads等于0
700  total_time等于0
704  如果parm_entries小于0则parm_entries等于1
707  entries等于两数取小(parm_entries, MAX_ENTRIES)
709  automatic_shrinking等于shrinking
710  max_size等于如果max_size否则undup_pow_of_two - round the given value up to nearest power of two*@n: parameter* round the given value up to the nearest power of two* - the result is undefined when n == 0* - this can be used to initialise global variables from constant data(entries)
711  nelem_hint等于size
713  objs等于vzalloc(array_size() - Calculate size of 2-dimensional array.*@a: dimension one*@b: dimension two* Calculates size of 2-dimensional array: @a *@b.* Returns: number of bytes needed to represent the array or SIZE_MAX on* overflow.)
715  如果非objs则返回:负ENOMEM
718  打印信息("Running rhashtable test nelem=%d, max_size=%d, shrinking=%d\n", size, max_size, shrinking)
721 i小于runs循环
724  打印信息("Test %02d:\n", i)
725  memset(objs, 0, max_size * sizeof(structtest_obj))
727  err等于hashtable_init - initialize a new hash table*@ht: hash table to be initialized*@params: configuration parameters* Initializes a new hash table based on the provided configuration* parameters
728  如果err小于0则
729  打印警告信息("Test failed: Unable to initialize hashtable: %d\n", err)
731  继续下一循环
734  time等于test_rhashtable( & ht, objs, entries)
735  rhashtable_destroy( & ht)
736  如果time小于0则
737  vfree(objs)
738  打印警告信息("Test failed: return code %lld\n", time)
739  返回:负EINVAL
742  total_time加等于time
745  打印信息("test if its possible to exceed max_size %d: %s\n", max_size, test_rhashtable_max(objs, entries) == 0 ? "no, ok" : "YES, failed")
748  vfree(objs)
750  do_div() is NOT a C function(total_time, runs)
751  打印信息("Average test time: %llu\n", total_time)
753  test_insert_duplicates_run()
755  如果非tcount则返回:0
758  打印信息("Testing concurrent rhashtable access from %d threads\n", tcount)
760  atomic_set( & startup_count, tcount)
761  tdata等于vzalloc(array_size() - Calculate size of 2-dimensional array.*@a: dimension one*@b: dimension two* Calculates size of 2-dimensional array: @a *@b.* Returns: number of bytes needed to represent the array or SIZE_MAX on* overflow.)
762  如果非tdata则返回:负ENOMEM
764  objs等于vzalloc(array3_size() - Calculate size of 3-dimensional array.*@a: dimension one*@b: dimension two*@c: dimension three* Calculates size of 3-dimensional array: @a *@b *@c.* Returns: number of bytes needed to represent the array or SIZE_MAX on* overflow.)
765  如果非objs
766  vfree(tdata)
767  返回:负ENOMEM
770  max_size等于如果max_size否则undup_pow_of_two - round the given value up to nearest power of two*@n: parameter* round the given value up to the nearest power of two* - the result is undefined when n == 0* - this can be used to initialise global variables from constant data(tcount * entries)
772  err等于hashtable_init - initialize a new hash table*@ht: hash table to be initialized*@params: configuration parameters* Initializes a new hash table based on the provided configuration* parameters
773  如果err小于0则
774  打印警告信息("Test failed: Unable to initialize hashtable: %d\n", err)
776  vfree(tdata)
777  vfree(objs)
778  返回:负EINVAL
780 i小于tcount循环
781  id等于i
782  entries等于entries
783  objs等于objsientries
784  task等于kthread_run - create and wake a thread.*@threadfn: the function to run until signal_pending(current).*@data: data ptr for @threadfn.*@namefmt: printf-style name for the thread.* Description: Convenient wrapper for kthread_create() followed by(threadfunc, & tdata[i], "rhashtable_thrad[%d]", i)
786  如果是错误
787  打印错误信息(" kthread_run failed for thread %d\n", i)
789  否则
790  started_threads自加
793  如果wait_event_interruptible - sleep until a condition gets true*@wq_head: the waitqueue to wait on*@condition: a C expression for the event to wait for* The process is put to sleep (TASK_INTERRUPTIBLE) until the(startup_wait, atomic_read( & startup_count) == 0)则打印错误信息(" wait_event interruptible failed\n")
796  atomic_dec( & startup_count)
797  wake_up_all( & startup_wait)
798 i小于tcount循环
799  如果是错误则继续下一循环
801  如果err等于结束线程的运行
802  打印警告信息("Test failed: thread %d returned: %d\n", i, err)
804  failed_threads自加
807  rhashtable_destroy( & ht)
808  vfree(tdata)
809  vfree(objs)
815  err等于test_rhltable(entries / 16)
816  打印信息("Started %d threads, %d failed, rhltable test returns %d\n", started_threads, failed_threads, err)
818  返回:0