Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\memblock.c Create Date:2022-07-28 15:09:52
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:memblock_double_array

Proto:static int __attribute__((__section__(".meminit.text"))) __attribute__((__cold__)) __attribute__((__no_instrument_function__))memblock_double_array(struct memblock_type *type, phys_addr_t new_area_start, phys_addr_t new_area_size)

Type:int

Parameter:

TypeParameterName
struct memblock_type *type
phys_addr_tnew_area_start
phys_addr_tnew_area_size
416  use_slab = slab_is_available()
422  If Not memblock_can_resize Then Return -1
426  old_size = max * sizeof(structmemblock_region)
427  new_size = old_size << 1
432  old_alloc_size = align the pointer to the (next) page boundary (old_size)
433  new_alloc_size = align the pointer to the (next) page boundary (new_size)
436  If type == memory Then in_slab = memblock_memory_in_slab
438  Else in_slab = memblock_reserved_in_slab
442  If use_slab Then
443  new_array = kmalloc(new_size, GFP_KERNEL)
444  addr = If new_array Then __pa(new_array) Else 0
445  Else
447  If type != reserved Then new_area_start = new_area_size = 0
450  addr = memblock_find_in_range(new_area_start + new_area_size, current_limit, new_alloc_size, PAGE_SIZE)
453  If Not addr && new_area_size Then addr = memblock_find_in_range(0, min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(new_area_start, current_limit), new_alloc_size, PAGE_SIZE)
458  new_array = addr ? __va(addr) : NULL
460  If Not addr Then
461  pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n", name, max, max * 2)
463  Return -1
466  new_end = addr + new_size - 1
475  No 3D Now!(new_array, regions, old_size)
476  memset(new_array + max, 0, old_size)
477  old_array = regions
478  regions = new_array
479  max <<= 1
482  If in_slab Then kfree(old_array)
484  Else if old_array != memblock_memory_init_regions && old_array != memblock_reserved_init_regions Then memblock_free(__pa(old_array), old_alloc_size)
492  If Not use_slab Then BUG_ON(memblock_reserve(addr, new_alloc_size))
496  in_slab = use_slab
498  Return 0
Caller
NameDescribe
memblock_add_range
memblock_isolate_range