History

mm/memory_hotplug: make unregister_memory_block_under_nodes() never fail

We really don't want anything during memory hotunplug to fail. We always pass a valid memory block device, that check can go. Avoid allocating memory and eventually failing. As we are always called under lock, we can use a static piece of memory. This avoids having to put the structure onto the stack, having to guess about the stack size of callers. Patch inspired by a patch from Oscar Salvador. In the future, there might be no need to iterate over nodes at all. mem->nid should tell us exactly what to remove. Memory block devices with mixed nodes (added during boot) should properly fenced off and never removed.

David Hildenbrand committed 7 years ago

Commit a31b2641 parent 4c4b7f92 files · +7 −16Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/node.h+2−3
@@ -139,7 +139,7 @@ extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); · 138 unmodified lines
139139 extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
140140 extern int register_mem_sect_under_node(struct memory_block *mem_blk,
141141 void *arg);
142−extern int unregister_memory_block_under_nodes(struct memory_block *mem_blk);
142+extern void unregister_memory_block_under_nodes(struct memory_block *mem_blk);
143143
144144 extern int register_memory_node_under_compute_node(unsigned int mem_nid,
145145 unsigned int cpu_nid,
@@ -175,9 +175,8 @@ static inline int register_mem_sect_under_node(struct memory_block *mem_blk, · 29 unmodified lines
175175 {
176176 return 0;
177177 }
178−static inline int unregister_memory_block_under_nodes(struct memory_block *mem_blk)
178+static inline void unregister_memory_block_under_nodes(struct memory_block *mem_blk)
179179 {
180− return 0;
181180 }
182181
183182 static inline void register_hugetlbfs_with_node(node_registration_func_t reg,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t