Function report |
Source Code:mm\percpu.c |
Create Date:2022-07-28 14:27:59 |
| Last Modify:2022-05-23 13:52:24 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:pcpu_setup_first_chunk - initialize the first percpu chunk*@ai: pcpu_alloc_info describing how to percpu area is shaped*@base_addr: mapped address* Initialize the first percpu chunk which contains the kernel static* percpu area
Proto:void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, void *base_addr)
Type:void
Parameter:
| Type | Parameter | Name |
|---|---|---|
| const struct pcpu_alloc_info * | ai | |
| void * | base_addr |
| 2274 | size_sum = static_size + reserved_size + dyn_size |
| 2317 | alloc_size = 0 if grouping unnecessary * size of group_offsets[0] |
| 2319 | If Not group_offsets Then panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns. |
| 2323 | alloc_size = 0 if grouping unnecessary * size of group_sizes[0] |
| 2325 | If Not group_sizes Then panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns. |
| 2329 | alloc_size = Setup number of possible processor ids * size of unit_map[0] |
| 2330 | unit_map = memblock_alloc(alloc_size, SMP_CACHE_BYTES) |
| 2331 | If Not unit_map Then panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns. |
| 2335 | alloc_size = Setup number of possible processor ids * size of unit_off[0] |
| 2336 | unit_off = memblock_alloc(alloc_size, SMP_CACHE_BYTES) |
| 2337 | If Not unit_off Then panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns. |
| 2344 | cpus with the lowest and highest unit addresses = Places which use this should consider cpumask_var_t. |
| 2347 | When group < 0 if grouping unnecessary cycle |
| 2350 | group_offsets[group] = base address offset |
| 2351 | group_sizes[group] = aligned # of units * unit_size |
| 2353 | When i < aligned # of units cycle |
| 2355 | If cpu == Places which use this should consider cpumask_var_t. Then Continue |
| 2363 | unit_off[cpu] = base address offset + i * unit_size |
| 2369 | If pcpu_high_unit_cpu == Places which use this should consider cpumask_var_t. || unit_off[cpu] > unit_off[pcpu_high_unit_cpu] Then pcpu_high_unit_cpu = cpu |
| 2374 | pcpu_nr_units = unit |
| 2376 | for_each_possible_cpu(cpu) |
| 2384 | pcpu_group_offsets = group_offsets |
| 2385 | pcpu_group_sizes = group_sizes |
| 2386 | pcpu_unit_map = unit_map |
| 2387 | pcpu_unit_offsets = unit_off |
| 2392 | pcpu_atom_size = atom_size |
| 2393 | pcpu_chunk_struct_size = sizeof(structpcpu_chunk) + BITS_TO_LONGS(pcpu_unit_pages) * sizeof(unsignedlong) |
| 2396 | pcpu_stats_save_ai(ai) |
| 2402 | pcpu_nr_slots = __pcpu_size_to_slot(pcpu_unit_size) + 2 |
| 2403 | pcpu_slot = memblock_alloc(pcpu_nr_slots * size of pcpu_slot[0] , SMP_CACHE_BYTES) |
| 2405 | If Not pcpu_slot Then panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns. |
| 2408 | When i < pcpu_nr_slots cycle Initialization list head |
| 2420 | dyn_size = dyn_size - static_size - static_size |
| 2430 | tmp_addr = base_addr + static_size |
| 2431 | map_size = If reserved_size Else dyn_size |
| 2435 | If reserved_size Then |
| 2436 | Optional reserved chunk. This chunk reserves part of the first* chunk and serves it for reserved allocations. When the reserved* region doesn't exist, the following variable is NULL. = chunk |
| 2438 | tmp_addr = base_addr + static_size + reserved_size |
| 2445 | The first chunk which always exists. Note that unlike other* chunks, this one can be allocated and mapped in several different* ways and thus often doesn't live in the vmalloc area. = chunk |
| 2446 | The number of empty populated pages, protected by pcpu_lock. The* reserved chunk doesn't contribute to the count. = # of empty populated pages |
| 2452 | pcpu_stats_chunk_alloc() |
| Name | Describe |
|---|---|
| setup_per_cpu_areas | UP 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. |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |