Lines Matching refs:memory

3  * Procedures for maintaining information about logical memory blocks.
39 * Memblock is a method of managing memory regions during the early
40 * boot period when the usual kernel memory allocators are not up and
43 * Memblock views the system memory as collections of contiguous
46 * * ``memory`` - describes the physical memory available to the
47 * kernel; this may differ from the actual physical memory installed
48 * in the system, for instance when the memory is restricted with
51 * * ``physmem`` - describes the actual physical memory available during
52 * boot regardless of the possible restrictions and memory hot(un)plug;
57 * systems. Every memory type is described by the struct memblock_type
58 * which contains an array of memory regions along with
59 * the allocator metadata. The "memory" and "reserved" types are nicely
62 * %INIT_MEMBLOCK_MEMORY_REGIONS for "memory" and
67 * with care so that memory allocated for the region array will not
71 * memory layout is by using memblock_add() or memblock_add_node()
78 * Once memblock is setup the memory can be allocated using one of the
82 * address of the allocated memory
84 * of the allocated memory.
87 * memory ranges and the fallback methods. Consult the documentation
92 * function frees all the memory to the buddy page allocator.
116 .memory.regions = memblock_memory_init_regions,
117 .memory.cnt = 1, /* empty dummy entry */
118 .memory.max = INIT_MEMBLOCK_MEMORY_REGIONS,
119 .memory.name = "memory",
140 * keep a pointer to &memblock.memory in the text section to use it in
145 static __refdata struct memblock_type *memblock_memory = &memblock.memory;
212 * @flags: pick from blocks based on memory attributes
247 * @flags: pick from blocks based on memory attributes
286 * @flags: pick from blocks based on memory attributes
340 pr_warn_ratelimited("Could not allocate %pap bytes of mirrored memory\n",
369 * memblock_discard - discard memory and reserved arrays if they were allocated
385 if (memblock.memory.regions != memblock_memory_init_regions) {
386 addr = __pa(memblock.memory.regions);
388 memblock.memory.max);
390 kfree(memblock.memory.regions);
402 * @new_area_start: starting address of memory range to avoid overlap with
403 * @new_area_size: size of memory range to avoid overlap with
406 * allocate memory for a new reserved regions array and there is a previously
407 * allocated memory range [@new_area_start, @new_area_start + @new_area_size]
408 * waiting to be reserved, ensure the memory used by the new array does
425 * of memory that aren't suitable for allocation
441 if (type == &memblock.memory)
700 * Add new memblock region [@base, @base + @size) to the "memory"
714 return memblock_add_range(&memblock.memory, base, size, nid, flags);
722 * Add new memblock region [@base, @base + @size) to the "memory"
735 return memblock_add_range(&memblock.memory, base, size, MAX_NUMNODES, 0);
739 * memblock_validate_numa_coverage - check if amount of memory with
744 * A buggy firmware may report memory that does not belong to any node.
745 * Check if amount of such memory is below @threshold_bytes.
870 return memblock_remove_range(&memblock.memory, base, size);
874 * memblock_free - free boot memory allocation
875 * @ptr: starting address of the boot memory allocation
876 * @size: size of the boot memory block in bytes
878 * Free boot memory block previously allocated by memblock_alloc_xx() API.
879 * The freeing memory will not be released to the buddy allocator.
888 * memblock_phys_free - free boot memory block
889 * @base: phys starting address of the boot memory block
890 * @size: size of the boot memory block in bytes
892 * Free boot memory block previously allocated by memblock_phys_alloc_xx() API.
893 * The freeing memory will not be released to the buddy allocator.
929 * memblock_setclr_flag - set or clear flag for a memory region
963 * memblock_mark_hotplug - Mark hotpluggable memory with flag MEMBLOCK_HOTPLUG.
971 return memblock_setclr_flag(&memblock.memory, base, size, 1, MEMBLOCK_HOTPLUG);
983 return memblock_setclr_flag(&memblock.memory, base, size, 0, MEMBLOCK_HOTPLUG);
987 * memblock_mark_mirror - Mark mirrored memory with flag MEMBLOCK_MIRROR.
1000 return memblock_setclr_flag(&memblock.memory, base, size, 1, MEMBLOCK_MIRROR);
1004 * memblock_mark_nomap - Mark a memory region with flag MEMBLOCK_NOMAP.
1008 * The memory regions marked with %MEMBLOCK_NOMAP will not be added to the
1009 * direct mapping of the physical memory. These regions will still be
1010 * covered by the memory map. The struct page representing NOMAP memory
1011 * frames in the memory map will be PageReserved()
1013 * Note: if the memory being marked %MEMBLOCK_NOMAP was allocated from
1014 * memblock, the caller must inform kmemleak to ignore that memory
1020 return memblock_setclr_flag(&memblock.memory, base, size, 1, MEMBLOCK_NOMAP);
1032 return memblock_setclr_flag(&memblock.memory, base, size, 0, MEMBLOCK_NOMAP);
1036 * memblock_reserved_mark_noinit - Mark a reserved memory region with flag
1042 * struct pages will not be initialized for reserved memory regions marked with
1063 /* only memory regions are associated with nodes, check it */
1067 /* skip hotpluggable memory regions if needed */
1072 /* if we want mirror memory skip non-mirror memory regions */
1076 /* skip nomap memory unless we were asked for it explicitly */
1080 /* skip driver-managed memory unless we were asked for it explicitly */
1091 * @flags: pick from blocks based on memory attributes
1093 * @type_b: pointer to memblock_type which excludes memory from being taken
1196 * @flags: pick from blocks based on memory attributes
1198 * @type_b: pointer to memblock_type which excludes memory from being taken
1296 struct memblock_type *type = &memblock.memory;
1363 * @zone: zone in which all of the memory blocks reside
1369 * deferred memory init routines and as such we were duplicating much of
1382 &memblock.memory, &memblock.reserved,
1409 &memblock.memory, &memblock.reserved,
1423 * memblock_alloc_range_nid - allocate boot memory block
1424 * @size: size of memory block to be allocated in bytes
1426 * @start: the lower bound of the memory region to allocate (phys address)
1427 * @end: the upper bound of the memory region to allocate (phys address)
1431 * The allocation is performed from memory region limited by
1434 * If the specified node can not hold the requested memory and @exact_nid
1437 * For systems with memory mirroring, the allocation is attempted first
1439 * memory region.
1442 * memory block, it is never reported as leaks.
1445 * Physical address of allocated memory block on success, %0 on failure.
1480 pr_warn_ratelimited("Could not allocate %pap bytes of mirrored memory\n",
1503 * require memory to be accepted before it can be used by the
1506 * Accept the memory of the allocated buffer.
1514 * memblock_phys_alloc_range - allocate a memory block inside specified range
1515 * @size: size of memory block to be allocated in bytes
1517 * @start: the lower bound of the memory region to allocate (physical address)
1518 * @end: the upper bound of the memory region to allocate (physical address)
1522 * Return: physical address of the allocated memory block on success,
1538 * memblock_phys_alloc_try_nid - allocate a memory block from specified NUMA node
1539 * @size: size of memory block to be allocated in bytes
1543 * Allocates memory block from the specified NUMA node. If the node
1544 * has no available memory, attempts to allocated from any node in the
1547 * Return: physical address of the allocated memory block on success,
1557 * memblock_alloc_internal - allocate boot memory block
1558 * @size: size of memory block to be allocated in bytes
1560 * @min_addr: the lower bound of the memory region to allocate (phys address)
1561 * @max_addr: the upper bound of the memory region to allocate (phys address)
1565 * Allocates memory block using memblock_alloc_range_nid() and
1569 * will fall back to memory below @min_addr. Other constraints, such
1570 * as node and mirrored memory will be handled again in
1574 * Virtual address of allocated memory block on success, NULL on failure.
1609 * memblock_alloc_exact_nid_raw - allocate boot memory block on the exact node
1610 * without zeroing memory
1611 * @size: size of memory block to be allocated in bytes
1613 * @min_addr: the lower bound of the memory region from where the allocation
1615 * @max_addr: the upper bound of the memory region from where the allocation
1617 * allocate only from memory limited by memblock.current_limit value
1621 * info), if enabled. Does not zero allocated memory.
1624 * Virtual address of allocated memory block on success, NULL on failure.
1640 * memblock_alloc_try_nid_raw - allocate boot memory block without zeroing
1641 * memory and without panicking
1642 * @size: size of memory block to be allocated in bytes
1644 * @min_addr: the lower bound of the memory region from where the allocation
1646 * @max_addr: the upper bound of the memory region from where the allocation
1648 * allocate only from memory limited by memblock.current_limit value
1652 * info), if enabled. Does not zero allocated memory, does not panic if request
1656 * Virtual address of allocated memory block on success, NULL on failure.
1672 * memblock_alloc_try_nid - allocate boot memory block
1673 * @size: size of memory block to be allocated in bytes
1675 * @min_addr: the lower bound of the memory region from where the allocation
1677 * @max_addr: the upper bound of the memory region from where the allocation
1679 * allocate only from memory limited by memblock.current_limit value
1683 * info), if enabled. This function zeroes the allocated memory.
1686 * Virtual address of allocated memory block on success, NULL on failure.
1708 * @base: phys starting address of the boot memory block
1709 * @size: size of the boot memory block in bytes
1738 return memblock.memory.total_size;
1749 return memblock.memory.regions[0].base;
1754 int idx = memblock.memory.cnt - 1;
1756 return (memblock.memory.regions[idx].base + memblock.memory.regions[idx].size);
1765 * translate the memory @limit size into the max address within one of
1766 * the memory memblock regions, if the @limit exceeds the total size
1789 /* @limit exceeds the total size of the memory, do nothing */
1793 /* truncate both memory and reserved regions */
1794 memblock_remove_range(&memblock.memory, max_addr,
1809 pr_warn("%s: No memory registered yet\n", __func__);
1813 ret = memblock_isolate_range(&memblock.memory, base, size,
1819 for (i = memblock.memory.cnt - 1; i >= end_rgn; i--)
1820 if (!memblock_is_nomap(&memblock.memory.regions[i]))
1821 memblock_remove_region(&memblock.memory, i);
1824 if (!memblock_is_nomap(&memblock.memory.regions[i]))
1825 memblock_remove_region(&memblock.memory, i);
1842 /* @limit exceeds the total size of the memory, do nothing */
1874 return memblock_search(&memblock.memory, addr) != -1;
1879 int i = memblock_search(&memblock.memory, addr);
1883 return !memblock_is_nomap(&memblock.memory.regions[i]);
1889 struct memblock_type *type = &memblock.memory;
1902 * memblock_is_region_memory - check if a region is a subset of memory
1906 * Check if the region [@base, @base + @size) is a subset of a memory block.
1913 int idx = memblock_search(&memblock.memory, base);
1918 return (memblock.memory.regions[idx].base +
1919 memblock.memory.regions[idx].size) >= end;
1923 * memblock_is_region_reserved - check if a region intersects reserved memory
1928 * memory block.
1956 memblock_remove_region(&memblock.memory,
1957 r - memblock.memory.regions);
2002 pr_info(" memory size = %pa reserved size = %pa\n",
2003 &memblock.memory.total_size,
2006 memblock_dump(&memblock.memory);
2059 * The mem_map array can get very big. Free the unused area of the memory map.
2084 * presume that there are no holes in the memory map inside
2098 * presume that there are no holes in the memory map inside
2300 debugfs_create_file("memory", 0444, root,
2301 &memblock.memory, &memblock_debug_fops);