Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

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:

TypeParameterName
const struct pcpu_alloc_info *ai
void *base_addr
2274  size_sum = static_size + reserved_size + dyn_size
2298  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( 0 if grouping unnecessary <= 0)
2303  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(!base_addr)
2304  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(offset_in_page(base_addr))
2305  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(unit_size < size_sum)
2306  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(offset_in_page(unit_size))
2307  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(unit_size < minimum unit size, also is the maximum supported allocation size )
2308  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(!IS_ALIGNED(unit_size, The PCPU_BITMAP_BLOCK_SIZE must be the same size as PAGE_SIZE as the* updating of hints is used to manage the nr_empty_pop_pages in both* the chunk and globally.))
2309  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(dyn_size < PERCPU_DYNAMIC_EARLY_SIZE)
2310  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(!dyn_size)
2311  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(!IS_ALIGNED(reserved_size, PCPU_MIN_ALLOC_SIZE))
2312  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(!(IS_ALIGNED(The PCPU_BITMAP_BLOCK_SIZE must be the same size as PAGE_SIZE as the* updating of hints is used to manage the nr_empty_pop_pages in both* the chunk and globally., PAGE_SIZE) || IS_ALIGNED(PAGE_SIZE, The PCPU_BITMAP_BLOCK_SIZE must be the same size as PAGE_SIZE as the* updating of hints is used to manage the nr_empty_pop_pages in both* the chunk and globally.)))
2314  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(pcpu_verify_alloc_info(ai) < 0)
2317  alloc_size = 0 if grouping unnecessary * size of group_offsets[0]
2318  group_offsets = memblock_alloc(alloc_size, SMP_CACHE_BYTES)
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]
2324  group_sizes = memblock_alloc(alloc_size, SMP_CACHE_BYTES)
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.
2341  When cpu < Setup number of possible processor ids cycle unit_map[cpu] = UINT_MAX
2344  cpus with the lowest and highest unit addresses = Places which use this should consider cpumask_var_t.
2345  pcpu_high_unit_cpu = Places which use this should consider cpumask_var_t.
2347  When group < 0 if grouping unnecessary cycle
2348  gi = groups[group]
2350  group_offsets[group] = base address offset
2351  group_sizes[group] = aligned # of units * unit_size
2362  unit_map[cpu] = unit + i
2374  pcpu_nr_units = unit
2376  for_each_possible_cpu(cpu)
2377  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(unit_map[cpu] == UINT_MAX)
2381  pcpu_dump_alloc_info - print out information about pcpu_alloc_info*@lvl: loglevel*@ai: allocation info to dump* Print out information about @ai using loglevel @lvl.
2383  group information, used for vm allocation = 0 if grouping unnecessary
2384  pcpu_group_offsets = group_offsets
2385  pcpu_group_sizes = group_sizes
2386  pcpu_unit_map = unit_map
2387  pcpu_unit_offsets = unit_off
2390  pcpu_unit_pages = unit_size >> PAGE_SHIFT determines the page size
2391  pcpu_unit_size = pcpu_unit_pages << PAGE_SHIFT determines the page size
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
2419  static_size = @a is a power of 2 value (static_size, PCPU_MIN_ALLOC_SIZE)
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
2432  chunk = pcpu_alloc_first_chunk - creates chunks that serve the first chunk*@tmp_addr: the start of the region served*@map_size: size of the region served* This is responsible for creating the chunks that serve the first chunk
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
2440  map_size = dyn_size
2441  chunk = pcpu_alloc_first_chunk - creates chunks that serve the first chunk*@tmp_addr: the start of the region served*@map_size: size of the region served* This is responsible for creating the chunks that serve the first chunk
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
2447  pcpu_chunk_relocate - put chunk in the appropriate chunk slot*@chunk: chunk of interest*@oslot: the previous slot it was on* This function is called after an allocation or free changed @chunk
2450  The number of populated pages in use by the allocator, protected by* pcpu_lock. This number is kept per a unit per chunk (i.e. when a page gets* allocated/deallocated, it is allocated/deallocated in all units of a chunk += PFN_DOWN(size_sum)
2452  pcpu_stats_chunk_alloc()
2453  trace_percpu_create_chunk(base_addr)
2456  he address of the first chunk which starts with the kernel static area = base_addr
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.