Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:NOTE: The caller must call lock_device_hotplug() to serialize hotplug* and online/offline operations (triggered e.g. by sysfs).* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG

Proto:int __ref add_memory_resource(int nid, struct resource *res)

Type:int

Parameter:

TypeParameterName
intnid
struct resource *res
1036  struct mhp_restrictions restrictions = {}
1038  bool new_node = false
1041  start = start
1042  size = resource_size(res)
1044  ret = check_hotplug_memory_range(start, size)
1045  If ret Then Return ret
1048  mem_hotplug_begin()
1056  memblock_add_node(start, size, nid)
1058  ret = ry_online_node - online a node if offlined*@nid: the node ID*@start: start addr of the node*@set_node_online: Whether we want to online the node* called by cpu_up() to online a node without onlined memory
1059  If ret < 0 Then Go to error
1061  new_node = ret
1064  ret = arch_add_memory(nid, start, size, & restrictions)
1065  If ret < 0 Then Go to error
1069  ret = create_memory_block_devices(start, size)
1070  If ret Then
1071  arch_remove_memory(nid, start, size, NULL)
1072  Go to error
1075  If new_node Then
1081  node_set_online(nid)
1082  ret = Core of the node registration - only memory hotplug should use this
1083  BUG_ON(ret)
1087  ret = link_mem_sections(nid, PFN_DOWN(start), PFN_UP(start + size - 1))
1088  BUG_ON(ret)
1091  firmware_map_add_hotplug(start, start + size, "System RAM")
1094  mem_hotplug_done()
1097  If memhp_auto_online Then walk_memory_blocks(start, size, NULL, online_memory_block)
1100  Return ret
1101  error :
1103  If new_node Then rollback_node_hotadd(nid)
1105  memblock_remove(start, size)
1106  mem_hotplug_done()
1107  Return ret
Caller
NameDescribe
__add_memoryquires device_hotplug_lock, see add_memory_resource()