memory_hotplug.c (952eea9b01e4bbb7011329f1b7240844e61e5128) | memory_hotplug.c (32befe9e27859b87e70e0aba9b60bfb8000d9a66) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/mm/memory_hotplug.c 4 * 5 * Copyright (C) 6 */ 7 8#include <linux/stddef.h> --- 1328 unchanged lines hidden (view full) --- 1337 * NOTE: The caller must call lock_device_hotplug() to serialize hotplug 1338 * and online/offline operations (triggered e.g. by sysfs). 1339 * 1340 * we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG 1341 */ 1342int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) 1343{ 1344 struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) }; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * linux/mm/memory_hotplug.c 4 * 5 * Copyright (C) 6 */ 7 8#include <linux/stddef.h> --- 1328 unchanged lines hidden (view full) --- 1337 * NOTE: The caller must call lock_device_hotplug() to serialize hotplug 1338 * and online/offline operations (triggered e.g. by sysfs). 1339 * 1340 * we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG 1341 */ 1342int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags) 1343{ 1344 struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) }; |
1345 enum memblock_flags memblock_flags = MEMBLOCK_NONE; |
|
1345 struct vmem_altmap mhp_altmap = {}; 1346 struct memory_group *group = NULL; 1347 u64 start, size; 1348 bool new_node = false; 1349 int ret; 1350 1351 start = res->start; 1352 size = resource_size(res); --- 12 unchanged lines hidden (view full) --- 1365 if (!node_possible(nid)) { 1366 WARN(1, "node %d was absent from the node_possible_map\n", nid); 1367 return -EINVAL; 1368 } 1369 1370 mem_hotplug_begin(); 1371 1372 if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) { | 1346 struct vmem_altmap mhp_altmap = {}; 1347 struct memory_group *group = NULL; 1348 u64 start, size; 1349 bool new_node = false; 1350 int ret; 1351 1352 start = res->start; 1353 size = resource_size(res); --- 12 unchanged lines hidden (view full) --- 1366 if (!node_possible(nid)) { 1367 WARN(1, "node %d was absent from the node_possible_map\n", nid); 1368 return -EINVAL; 1369 } 1370 1371 mem_hotplug_begin(); 1372 1373 if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) { |
1373 ret = memblock_add_node(start, size, nid, MEMBLOCK_NONE); | 1374 if (res->flags & IORESOURCE_SYSRAM_DRIVER_MANAGED) 1375 memblock_flags = MEMBLOCK_DRIVER_MANAGED; 1376 ret = memblock_add_node(start, size, nid, memblock_flags); |
1374 if (ret) 1375 goto error_mem_hotplug_end; 1376 } 1377 1378 ret = __try_online_node(nid, false); 1379 if (ret < 0) 1380 goto error; 1381 new_node = ret; --- 954 unchanged lines hidden --- | 1377 if (ret) 1378 goto error_mem_hotplug_end; 1379 } 1380 1381 ret = __try_online_node(nid, false); 1382 if (ret < 0) 1383 goto error; 1384 new_node = ret; --- 954 unchanged lines hidden --- |