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.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -139,7 +139,7 @@ extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); · 138 unmodified lines | ||
| 139 | 139 | extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); |
| 140 | 140 | extern int register_mem_sect_under_node(struct memory_block *mem_blk, |
| 141 | 141 | 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); | |
| 143 | 143 | |
| 144 | 144 | extern int register_memory_node_under_compute_node(unsigned int mem_nid, |
| 145 | 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 | 176 | return 0; |
| 177 | 177 | } |
| 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) | |
| 179 | 179 | { |
| 180 | − return 0; | |
| 181 | 180 | } |
| 182 | 181 | |
| 183 | 182 | static inline void register_hugetlbfs_with_node(node_registration_func_t reg, |