Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\math\prime_numbers.c Create Date:2022-07-28 06:43:31
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:expand_to_next_prime

Proto:static bool expand_to_next_prime(unsigned long x)

Type:bool

Parameter:

TypeParameterName
unsigned longx
123  sz = 2 * x
124  If sz < x Then Return false
127  sz = und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(sz, BITS_PER_LONG)
128  new = kmalloc( size of new + bitmap_size(sz), GFP_KERNEL | DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.)
130  If Not new Then Return false
133  mutex_lock( & lock)
134  p = cu_dereference_protected() - fetch RCU pointer when updates prevented*@p: The pointer to read, prior to dereferencing*@c: The conditions under which the dereference will take place* Return the value of the specified RCU-protected pointer, but omit(primes, lockdep_is_held( & lock))
135  If x < last Then
136  kfree(new)
137  Go to unlock
144  bitmap_fill(primes, sz)
145  bitmap_copy(primes, primes, sz)
146  When y < sz cycle last = clear_multiples(y, primes, sz, sz)
148  sz = sz
150  BUG_ON(last <= x)
152  cu_assign_pointer() - assign to RCU-protected pointer*@p: pointer to assign to*@v: value to assign (publish)* Assigns the specified value to the specified RCU-protected* pointer, ensuring that any concurrent RCU readers will see* any prior initialization(primes, new)
153  If p != small_primes Then kfree_rcu() - kfree an object after a grace period((structprimes * )p, rcu)
156  unlock :
157  mutex_unlock( & lock)
158  Return true
Caller
NameDescribe
next_prime_numberxt_prime_number - return the next prime number*@x: the starting point for searching to test* A prime number is an integer greater than 1 that is only divisible by* itself and 1
is_prime_numbers_prime_number - test whether the given number is prime*@x: the number to test* A prime number is an integer greater than 1 that is only divisible by* itself and 1