函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

函数原型:static struct pcpu_chunk *__init pcpu_alloc_first_chunk(unsigned long tmp_addr, int map_size)

返回类型:struct pcpu_chunk

参数:

类型参数名称
unsigned longtmp_addr
intmap_size
1317  aligned_addr等于tmp_addr按位与PAGE_MASK
1319  start_offset等于tmp_addraligned_addr
1326  lcm_align等于Lowest common multiple
1327  region_size等于@a is a power of 2 value (start_offset + map_size, lcm_align)
1330  alloc_size等于sizeof(structpcpu_chunk)加BITS_TO_LONGS(region_size >> PAGE_SHIFT determines the page size )
1332  chunk等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
1333  如果非chunkpanic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
1337  初始化链表头
1339  base address of this chunk 等于aligned_addr
1340  the overlap with the previous region to have a page aligned base_addr 等于start_offset
1341  additional area required to have the region end page aligned 等于region_size the overlap with the previous region to have a page aligned base_addr map_size
1343  # of pages served by this chunk 等于region_size右移PAGE_SHIFT determines the page size
1344  region_bits等于pcpu_chunk_map_bits - helper to convert nr_pages to size of bitmap*@chunk: chunk of interest* This conversion is from the number of physical pages that the chunk* serves to the number of bits in the bitmap.
1346  alloc_size等于BITS_TO_LONGS(region_bits)乘 allocation map [0]的长度
1347  allocation map 等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
1348  如果非 allocation map panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
1352  alloc_size等于BITS_TO_LONGS(region_bits + 1)乘 boundary map [0]的长度
1354  boundary map 等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
1355  如果非 boundary map panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
1359  alloc_size等于pcpu_chunk_nr_blocks - converts nr_pages to # of md_blocks*@chunk: chunk of interest* This conversion is from the number of physical pages that the chunk* serves to the number of bitmap blocks used. metadata blocks [0]的长度
1360  metadata blocks 等于memblock_alloc(alloc_size, SMP_CACHE_BYTES)
1361  如果非 metadata blocks panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
1365  pcpu_init_md_blocks(chunk)
1368  no [de]population allowed = true
1369  bitmap_fill( populated bitmap , # of pages served by this chunk )
1370  # of populated pages 等于 # of pages served by this chunk
1371  # of empty populated pages 等于 # of pages served by this chunk
1373  free bytes in the chunk 等于map_size
1375  如果 the overlap with the previous region to have a page aligned base_addr
1377  offset_bits等于 the overlap with the previous region to have a page aligned base_addr PCPU_MIN_ALLOC_SIZE
1378  bitmap_set( allocation map , 0, offset_bits)
1379  设置内存位
1380  设置内存位
1382  lock position of first free 等于offset_bits
1384  pcpu_block_update_hint_alloc - update hint on allocation path*@chunk: chunk of interest*@bit_off: chunk offset*@bits: size of request* Updates metadata for the allocation path. The metadata only has to be
1387  如果 additional area required to have the region end page aligned
1389  offset_bits等于 additional area required to have the region end page aligned PCPU_MIN_ALLOC_SIZE
1390  bitmap_set( allocation map , pcpu_chunk_map_bits - helper to convert nr_pages to size of bitmap*@chunk: chunk of interest* This conversion is from the number of physical pages that the chunk* serves to the number of bits in the bitmap. - offset_bits, offset_bits)
1393  设置内存位
1395  设置内存位
1397  pcpu_block_update_hint_alloc - update hint on allocation path*@chunk: chunk of interest*@bit_off: chunk offset*@bits: size of request* Updates metadata for the allocation path. The metadata only has to be
1401  返回:chunk
调用者
名称描述
pcpu_setup_first_chunkpcpu_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