Lines Matching full:memory
3 * Memory subsystem support
9 * a SPARSEMEM-memory-model system's physical memory in /sysfs.
19 #include <linux/memory.h>
29 #define MEMORY_CLASS_NAME "memory"
79 * Memory blocks are cached in a local radix tree to avoid
86 * Memory groups, indexed by memory group id (mgid).
119 /* Show the memory block ID, relative to the memory block size */
199 * they describe (they remain until the memory is unplugged), doing in memory_block_online()
200 * their initialization and accounting at memory onlining/offlining in memory_block_online()
202 * belong to the same zone as the memory they backed. in memory_block_online()
386 * covered by a memory block, allowing for identifying which memory blocks
387 * comprise a storage increment. Since a memory block spans complete
433 * If !mem->zone, the memory block spans multiple zones and in valid_zones_show()
464 * Show the memory block size (shared by all memory blocks).
475 * Memory auto online policy.
554 * Support for offlining pages of memory
602 * A reference for the returned memory block device is acquired.
646 static int __add_memory_block(struct memory_block *memory) in __add_memory_block() argument
650 memory->dev.bus = &memory_subsys; in __add_memory_block()
651 memory->dev.id = memory->start_section_nr / sections_per_block; in __add_memory_block()
652 memory->dev.release = memory_block_release; in __add_memory_block()
653 memory->dev.groups = memory_memblk_attr_groups; in __add_memory_block()
654 memory->dev.offline = memory->state == MEM_OFFLINE; in __add_memory_block()
656 ret = device_register(&memory->dev); in __add_memory_block()
658 put_device(&memory->dev); in __add_memory_block()
661 ret = xa_err(xa_store(&memory_blocks, memory->dev.id, memory, in __add_memory_block()
664 device_unregister(&memory->dev); in __add_memory_block()
679 * This logic only works for early memory, when the applicable zones in early_node_zone_for_memory_block()
680 * already span the memory block. We don't expect overlapping zones on in early_node_zone_for_memory_block()
681 * a single node for early memory. So if we're told that some PFNs in early_node_zone_for_memory_block()
682 * of a node fall into this memory block, we can assume that all node in early_node_zone_for_memory_block()
683 * zones that intersect with the memory block are actually applicable. in early_node_zone_for_memory_block()
705 * memory_block_add_nid() - Indicate that system RAM falling into this memory
707 * @mem: The memory block device.
709 * @context: The memory initialization context.
711 * Indicate that system RAM falling into this memory block (partially) belongs
721 * For early memory we have to determine the zone when setting in memory_block_add_nid()
723 * memory block by indicate via zone == NULL that we're not in memory_block_add_nid()
736 * If this memory block spans multiple nodes, we only indicate in memory_block_add_nid()
738 * to hotplugged memory), zone == NULL will prohibit memory offlining in memory_block_add_nid()
770 * MEM_ONLINE at this point implies early memory. With NUMA, in add_memory_block()
772 * memory_block_add_nid(). Memory hotplug updated the zone in add_memory_block()
773 * manually when memory onlining/offlining succeeds. in add_memory_block()
813 static void remove_memory_block(struct memory_block *memory) in remove_memory_block() argument
815 if (WARN_ON_ONCE(memory->dev.bus != &memory_subsys)) in remove_memory_block()
818 WARN_ON(xa_erase(&memory_blocks, memory->dev.id) == NULL); in remove_memory_block()
820 if (memory->group) { in remove_memory_block()
821 list_del(&memory->group_next); in remove_memory_block()
822 memory->group = NULL; in remove_memory_block()
826 put_device(&memory->dev); in remove_memory_block()
827 device_unregister(&memory->dev); in remove_memory_block()
831 * Create memory block devices for the given memory area. Start and size
832 * have to be aligned to memory block granularity. Memory block devices
870 * Remove memory block devices for the given memory area. Start and size
871 * have to be aligned to memory block granularity. Memory block devices
925 * Initialize the sysfs support for memory devices. At the time this function
926 * is called, we cannot have concurrent creation/deletion of memory block
934 /* Validate the configured memory block size */ in memory_dev_init()
937 panic("Memory block size not suitable: 0x%lx\n", block_sz); in memory_dev_init()
945 * Create entries for memory sections that were found in memory_dev_init()
952 panic("%s() failed to add memory block: %d\n", __func__, in memory_dev_init()
958 * walk_memory_blocks - walk through all present memory blocks overlapped
961 * @start: start address of the memory range
962 * @size: size of the memory range
964 * @func: callback for each memory section walked
966 * This function walks through all present memory blocks overlapped by the
967 * range [start, start + size), calling func on each memory block.
1013 * for_each_memory_block - walk through all present memory blocks
1016 * @func: callback for each memory block walked
1018 * This function walks through all present memory blocks, calling func on
1019 * each memory block.
1037 * memory groups. Note that the passed memory group will be copied to a
1038 * dynamically allocated memory group. After this call, the passed
1039 * memory group should no longer be used.
1068 * memory_group_register_static() - Register a static memory group.
1070 * @max_pages: The maximum number of pages we'll have in this static memory
1073 * Register a new static memory group and return the memory group id.
1074 * All memory in the group belongs to a single unit, such as a DIMM. All
1075 * memory belonging to a static memory group is added in one go to be removed
1078 * Returns an error if out of memory, if the node id is invalid, if no new
1079 * memory groups can be registered, or if max_pages is invalid (0). Otherwise,
1080 * returns the new memory group id.
1098 * memory_group_register_dynamic() - Register a dynamic memory group.
1100 * @unit_pages: Unit in pages in which is memory added/removed in this dynamic
1101 * memory group.
1103 * Register a new dynamic memory group and return the memory group id.
1104 * Memory within a dynamic memory group is added/removed dynamically
1107 * Returns an error if out of memory, if the node id is invalid, if no new
1108 * memory groups can be registered, or if unit_pages is invalid (0, not a
1109 * power of two, smaller than a single memory block). Otherwise, returns the
1110 * new memory group id.
1130 * memory_group_unregister() - Unregister a memory group.
1131 * @mgid: the memory group id
1133 * Unregister a memory group. If any memory block still belongs to this
1134 * memory group, unregistering will fail.
1136 * Returns -EINVAL if the memory group id is invalid, returns -EBUSY if some
1137 * memory blocks still belong to this memory group and returns 0 if
1159 * This is an internal helper only to be used in core memory hotplug code to
1160 * lookup a memory group. We don't care about locking, as we don't expect a
1161 * memory group to get unregistered while adding memory to it -- because
1162 * the group and the memory is managed by the same driver.
1170 * This is an internal helper only to be used in core memory hotplug code to
1171 * walk all dynamic memory groups excluding a given memory group, either