Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:pcpu_alloc_area - allocates an area from a pcpu_chunk*@chunk: chunk of interest*@alloc_bits: size of request in allocation units*@align: alignment of area (max PAGE_SIZE)*@start: bit_off to start searching* This function takes in a @start offset to begin

Proto:static int pcpu_alloc_area(struct pcpu_chunk *chunk, int alloc_bits, size_t align, int start)

Type:int

Parameter:

TypeParameterName
struct pcpu_chunk *chunk
intalloc_bits
size_talign
intstart
1189  chunk_md = chunk_md
1190  align_mask = If align Then align - 1 Else 0
1191  area_off = 0 , area_bits = 0
1194  lockdep_assert_held( & pcpu_lock)
1196  oslot = pcpu_chunk_slot(chunk)
1201  end = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(int, start + alloc_bits + PCPU_BITMAP_BLOCK_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.)
1203  bit_off = pcpu_find_zero_area - modified from bitmap_find_next_zero_area_off()*@map: the address to base the search on*@size: the bitmap size in bits*@start: the bitnumber to start searching at*@nr: the number of zeroed bits we're looking for*@align_mask: alignment
1205  If bit_off >= end Then Return -1
1208  If area_bits Then pcpu_block_update_scan - update a block given a free area from a scan*@chunk: chunk of interest*@bit_off: chunk offset*@bits: size of free area* Finding the final allocation spot first goes through pcpu_find_block_fit()* to find a block that can hold the
1212  bitmap_set( allocation map , bit_off, alloc_bits)
1215  Atomically set a bit in memory
1216  bitmap_clear( boundary map , bit_off + 1, alloc_bits - 1)
1217  Atomically set a bit in memory
1219  free bytes in the chunk -= alloc_bits * PCPU_MIN_ALLOC_SIZE
1222  If bit_off == lock position of first free Then lock position of first free = Find the next zero bit in a memory region.
1228  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
1230  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
1232  Return bit_off * PCPU_MIN_ALLOC_SIZE
Caller
NameDescribe
pcpu_allocpcpu_alloc - the percpu allocator*@size: size of area to allocate in bytes*@align: alignment of area (max PAGE_SIZE)*@reserved: allocate from the reserved chunk if available*@gfp: allocation flags* Allocate percpu area of @size bytes aligned at @align