Skip to content

Commit

Permalink
mm: do_migrate_range: reduce list_empty() check
Browse files Browse the repository at this point in the history
Simple code for reducing list_empty(&source) check.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Bob Liu authored and Linus Torvalds committed Oct 26, 2010
1 parent 809c444 commit f3ab263
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,24 +705,21 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
check this again here. */
if (page_count(page)) {
not_managed++;
ret = -EBUSY;
break;
}
}
}
ret = -EBUSY;
if (not_managed) {
if (!list_empty(&source))
if (!list_empty(&source)) {
if (not_managed) {
putback_lru_pages(&source);
goto out;
}
/* this function returns # of failed pages */
ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
if (ret)
putback_lru_pages(&source);
goto out;
}
ret = 0;
if (list_empty(&source))
goto out;
/* this function returns # of failed pages */
ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
if (ret)
putback_lru_pages(&source);

out:
return ret;
}
Expand Down

0 comments on commit f3ab263

Please sign in to comment.