diff options
author | Bob Liu <lliubbo@gmail.com> | 2010-10-26 17:22:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-26 19:52:11 -0400 |
commit | f3ab2636c5c1dd9ab0ff53a46d8354d5769ffdd4 (patch) | |
tree | 4173f57c2c37800dc5b3f5f08b294d560e645e9d /mm/memory_hotplug.c | |
parent | 809c444977adb7313e0612e9e3af4b73ba3f5746 (diff) |
mm: do_migrate_range: reduce list_empty() check
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>
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e4af144ee409..9260314a221e 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -705,24 +705,21 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) | |||
705 | check this again here. */ | 705 | check this again here. */ |
706 | if (page_count(page)) { | 706 | if (page_count(page)) { |
707 | not_managed++; | 707 | not_managed++; |
708 | ret = -EBUSY; | ||
708 | break; | 709 | break; |
709 | } | 710 | } |
710 | } | 711 | } |
711 | } | 712 | } |
712 | ret = -EBUSY; | 713 | if (!list_empty(&source)) { |
713 | if (not_managed) { | 714 | if (not_managed) { |
714 | if (!list_empty(&source)) | 715 | putback_lru_pages(&source); |
716 | goto out; | ||
717 | } | ||
718 | /* this function returns # of failed pages */ | ||
719 | ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1); | ||
720 | if (ret) | ||
715 | putback_lru_pages(&source); | 721 | putback_lru_pages(&source); |
716 | goto out; | ||
717 | } | 722 | } |
718 | ret = 0; | ||
719 | if (list_empty(&source)) | ||
720 | goto out; | ||
721 | /* this function returns # of failed pages */ | ||
722 | ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1); | ||
723 | if (ret) | ||
724 | putback_lru_pages(&source); | ||
725 | |||
726 | out: | 723 | out: |
727 | return ret; | 724 | return ret; |
728 | } | 725 | } |