Commit f3ab2636c5c1dd9ab0ff53a46d8354d5769ffdd4

Authored by Bob Liu
Committed by Linus Torvalds
1 parent 809c444977

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>

Showing 1 changed file with 9 additions and 12 deletions Side-by-side Diff

... ... @@ -705,24 +705,21 @@
705 705 check this again here. */
706 706 if (page_count(page)) {
707 707 not_managed++;
  708 + ret = -EBUSY;
708 709 break;
709 710 }
710 711 }
711 712 }
712   - ret = -EBUSY;
713   - if (not_managed) {
714   - if (!list_empty(&source))
  713 + if (!list_empty(&source)) {
  714 + if (not_managed) {
715 715 putback_lru_pages(&source);
716   - goto out;
  716 + goto out;
  717 + }
  718 + /* this function returns # of failed pages */
  719 + ret = migrate_pages(&source, hotremove_migrate_alloc, 0, 1);
  720 + if (ret)
  721 + putback_lru_pages(&source);
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 723 out:
727 724 return ret;
728 725 }