Skip to content

Commit aba6efc

Browse files
committed
Memory hotplug: Move alternative function definitions to header
Move the definitions of offline_pages() and remove_memory() for CONFIG_MEMORY_HOTREMOVE to memory_hotplug.h, where they belong, and make them static inline. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 173a5a4 commit aba6efc

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

‎include/linux/memory_hotplug.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ static inline void unlock_memory_hotplug(void) {}
234234

235235
extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
236236
extern void try_offline_node(int nid);
237+
extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
238+
extern void remove_memory(int nid, u64 start, u64 size);
237239

238240
#else
239241
static inline int is_mem_section_removable(unsigned long pfn,
@@ -243,6 +245,13 @@ static inline int is_mem_section_removable(unsigned long pfn,
243245
}
244246

245247
static inline void try_offline_node(int nid) {}
248+
249+
static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
250+
{
251+
return -EINVAL;
252+
}
253+
254+
static inline void remove_memory(int nid, u64 start, u64 size) {}
246255
#endif /* CONFIG_MEMORY_HOTREMOVE */
247256

248257
extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,

‎mm/memory_hotplug.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,11 +1822,5 @@ void __ref remove_memory(int nid, u64 start, u64 size)
18221822

18231823
unlock_memory_hotplug();
18241824
}
1825-
#else
1826-
int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
1827-
{
1828-
return -EINVAL;
1829-
}
1830-
void remove_memory(int nid, u64 start, u64 size) {}
1831-
#endif /* CONFIG_MEMORY_HOTREMOVE */
18321825
EXPORT_SYMBOL_GPL(remove_memory);
1826+
#endif /* CONFIG_MEMORY_HOTREMOVE */

0 commit comments

Comments
 (0)