Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\percpu.c Create Date:2022-07-28 14:27:39
Last Modify:2022-05-23 13:52:24 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:pcpu_alloc_alloc_info - allocate percpu allocation info*@nr_groups: the number of groups*@nr_units: the number of units* Allocate ai which is large enough for @nr_groups groups containing*@nr_units units

Proto:struct pcpu_alloc_info *__init pcpu_alloc_alloc_info(int nr_groups, int nr_units)

Type:struct pcpu_alloc_info

Parameter:

TypeParameterName
intnr_groups
intnr_units
2128  base_size = @a is a power of 2 value (struct_size() - Calculate size of structure with trailing array.*@p: Pointer to the structure.*@member: Name of the array member.*@n: Number of elements in the array.* Calculates size of memory needed for structure @p followed by an(ai, groups, nr_groups), __alignof__(cpu_map[0]))
2130  ai_size = base_size + nr_units * size of unit->cpu map, empty * entries contain NR_CPUS [0]
2132  ptr = memblock_alloc(PFN_ALIGN(ai_size), PAGE_SIZE)
2133  If Not ptr Then Return NULL
2135  ai = ptr
2136  ptr += base_size
2138  unit->cpu map, empty * entries contain NR_CPUS = ptr
2140  When unit < nr_units cycle unit->cpu map, empty * entries contain NR_CPUS [unit] = Places which use this should consider cpumask_var_t.
2143  0 if grouping unnecessary = nr_groups
2144  internal, don't use = PFN_ALIGN(ai_size)
2146  Return ai
Caller
NameDescribe
setup_per_cpu_areasUP percpu area setup.* UP always uses km-based percpu allocator with identity mapping.* Static percpu variables are indistinguishable from the usual static* variables and don't require any special preparation.