Skip to content

Commit

Permalink
Memory hotplug: Move alternative function definitions to header
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Jun 1, 2013
1 parent 173a5a4 commit aba6efc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 9 additions & 0 deletions include/linux/memory_hotplug.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ static inline void unlock_memory_hotplug(void) {}

extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
extern void try_offline_node(int nid);
extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
extern void remove_memory(int nid, u64 start, u64 size);

#else
static inline int is_mem_section_removable(unsigned long pfn,
Expand All @@ -243,6 +245,13 @@ static inline int is_mem_section_removable(unsigned long pfn,
}

static inline void try_offline_node(int nid) {}

static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
{
return -EINVAL;
}

static inline void remove_memory(int nid, u64 start, u64 size) {}
#endif /* CONFIG_MEMORY_HOTREMOVE */

extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
Expand Down
8 changes: 1 addition & 7 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1822,11 +1822,5 @@ void __ref remove_memory(int nid, u64 start, u64 size)

unlock_memory_hotplug();
}
#else
int offline_pages(unsigned long start_pfn, unsigned long nr_pages)
{
return -EINVAL;
}
void remove_memory(int nid, u64 start, u64 size) {}
#endif /* CONFIG_MEMORY_HOTREMOVE */
EXPORT_SYMBOL_GPL(remove_memory);
#endif /* CONFIG_MEMORY_HOTREMOVE */

0 comments on commit aba6efc

Please sign in to comment.