函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\percpu.c Create Date:2022-07-27 15:52:30
Last Modify:2022-05-23 13:52:24 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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

函数原型:void __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, void *base_addr)

返回类型:void

参数:

类型参数名称
const struct pcpu_alloc_info *ai
void *base_addr
2274  size_sum等于static_sizereserved_sizedyn_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 group_offsets[0]的长度
2318  group_offsets等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
2319  如果非group_offsetspanic - 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 group_sizes[0]的长度
2324  group_sizes等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
2325  如果非group_sizespanic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
2329  alloc_size等于CPU数量unit_map[0]的长度
2330  unit_map等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
2331  如果非unit_mappanic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
2335  alloc_size等于CPU数量unit_off[0]的长度
2336  unit_off等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
2337  如果非unit_offpanic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
2341 cpu小于CPU数量循环unit_map[cpu]等于UINT_MAX
2344  cpus with the lowest and highest unit addresses 等于CPU数量
2345  pcpu_high_unit_cpu等于CPU数量
2347 group小于 0 if grouping unnecessary 循环
2348  gi等于groups[group]
2350  group_offsets[group]等于 base address offset
2351  group_sizes[group]等于 aligned # of units unit_size
2353 i小于 aligned # of units 循环
2355  如果cpu恒等于CPU数量则继续下一循环
2362  unit_map[cpu]等于uniti
2374  pcpu_nr_units等于unit
2376  遍历可用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 * pcpu_slot[0]的长度, SMP_CACHE_BYTES)
2405  如果非pcpu_slotpanic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
2408 i小于pcpu_nr_slots循环初始化链表头
2419  static_size等于@a is a power of 2 value (static_size, PCPU_MIN_ALLOC_SIZE)
2420  dyn_size等于dyn_sizestatic_sizestatic_size
2430  tmp_addr等于base_addrstatic_size
2431  map_size等于如果reserved_size否则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  如果reserved_size
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_addrstatic_sizereserved_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
调用者
名称描述
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.