mm/migration: remove some duplicated codes in migrate_pages

Remove the duplicated codes in migrate_pages to simplify the code.  Minor
readability improvement.  No functional change intended.

Link: https://lkml.kernel.org/r/20220318111709.60311-9-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Miaohe Lin 2022-04-28 23:16:08 -07:00 коммит произвёл akpm
Родитель 91925ab8cc
Коммит f430893b01
1 изменённых файлов: 12 добавлений и 24 удалений

Просмотреть файл

@ -1410,14 +1410,11 @@ retry:
nr_thp_split++; nr_thp_split++;
goto retry; goto retry;
} }
/* Hugetlb migration is unsupported */
nr_failed_pages += nr_subpages; } else if (!no_subpage_counting) {
break; nr_failed++;
} }
/* Hugetlb migration is unsupported */
if (!no_subpage_counting)
nr_failed++;
nr_failed_pages += nr_subpages; nr_failed_pages += nr_subpages;
break; break;
case -ENOMEM: case -ENOMEM:
@ -1432,28 +1429,22 @@ retry:
nr_thp_split++; nr_thp_split++;
goto retry; goto retry;
} }
} else if (!no_subpage_counting) {
nr_failed_pages += nr_subpages; nr_failed++;
goto out;
} }
if (!no_subpage_counting)
nr_failed++;
nr_failed_pages += nr_subpages; nr_failed_pages += nr_subpages;
goto out; goto out;
case -EAGAIN: case -EAGAIN:
if (is_thp) { if (is_thp)
thp_retry++; thp_retry++;
break; else
} retry++;
retry++;
break; break;
case MIGRATEPAGE_SUCCESS: case MIGRATEPAGE_SUCCESS:
nr_succeeded += nr_subpages; nr_succeeded += nr_subpages;
if (is_thp) { if (is_thp)
nr_thp_succeeded++; nr_thp_succeeded++;
break;
}
break; break;
default: default:
/* /*
@ -1462,14 +1453,11 @@ retry:
* removed from migration page list and not * removed from migration page list and not
* retried in the next outer loop. * retried in the next outer loop.
*/ */
if (is_thp) { if (is_thp)
nr_thp_failed++; nr_thp_failed++;
nr_failed_pages += nr_subpages; else if (!no_subpage_counting)
break;
}
if (!no_subpage_counting)
nr_failed++; nr_failed++;
nr_failed_pages += nr_subpages; nr_failed_pages += nr_subpages;
break; break;
} }