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
139extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);139extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
140extern int register_mem_sect_under_node(struct memory_block *mem_blk,140extern int register_mem_sect_under_node(struct memory_block *mem_blk,
141 void *arg);141 void *arg);
142extern int unregister_memory_block_under_nodes(struct memory_block *mem_blk);142extern void unregister_memory_block_under_nodes(struct memory_block *mem_blk);
143 143
144extern int register_memory_node_under_compute_node(unsigned int mem_nid,144extern int register_memory_node_under_compute_node(unsigned int mem_nid,
145 unsigned int cpu_nid,145 unsigned int cpu_nid,
@@ -175,9 +175,8 @@ static inline int register_mem_sect_under_node(struct memory_block *mem_blk, · 29 unmodified lines
175{175{
176 return 0;176 return 0;
177}177}
178static inline int unregister_memory_block_under_nodes(struct memory_block *mem_blk)178static inline void unregister_memory_block_under_nodes(struct memory_block *mem_blk)
179{179{
180 return 0;
181}180}
182 181
183static inline void register_hugetlbfs_with_node(node_registration_func_t reg,182static 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