Skip to content

Commit

Permalink
mm/memory_hotplug: is_mem_section_removable() can return bool
Browse files Browse the repository at this point in the history
Make is_mem_section_removable() return bool to improve readability due
to this particular function only using either one or zero as its return
value.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Yaowei Bai authored and Linus Torvalds committed May 20, 2016
1 parent 32f6271 commit c98940f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions include/linux/memory_hotplug.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,16 @@ static inline void mem_hotplug_done(void) {}

#ifdef CONFIG_MEMORY_HOTREMOVE

extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
extern bool 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,
static inline bool is_mem_section_removable(unsigned long pfn,
unsigned long nr_pages)
{
return 0;
return false;
}

static inline void try_offline_node(int nid) {}
Expand Down
6 changes: 3 additions & 3 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,20 +1410,20 @@ static struct page *next_active_pageblock(struct page *page)
}

/* Checks if this range of memory is likely to be hot-removable. */
int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
{
struct page *page = pfn_to_page(start_pfn);
struct page *end_page = page + nr_pages;

/* Check the starting page of each pageblock within the range */
for (; page < end_page; page = next_active_pageblock(page)) {
if (!is_pageblock_removable_nolock(page))
return 0;
return false;
cond_resched();
}

/* All pageblocks in the memory block are likely to be hot-removable */
return 1;
return true;
}

/*
Expand Down

0 comments on commit c98940f

Please sign in to comment.