Commit f430893b authored by Miaohe Lin's avatar Miaohe Lin Committed by Andrew Morton
Browse files

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: default avatarMiaohe Lin <linmiaohe@huawei.com>
Reviewed-by: default avatarZi Yan <ziy@nvidia.com>
Reviewed-by: default avatarBaolin 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 91925ab8
Loading
Loading
Loading
Loading
+12 −24
Original line number Diff line number Diff line
@@ -1410,14 +1410,11 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
						nr_thp_split++;
						goto retry;
					}

					nr_failed_pages += nr_subpages;
					break;
				}

				/* Hugetlb migration is unsupported */
				if (!no_subpage_counting)
				} else if (!no_subpage_counting) {
					nr_failed++;
				}

				nr_failed_pages += nr_subpages;
				break;
			case -ENOMEM:
@@ -1432,29 +1429,23 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
						nr_thp_split++;
						goto retry;
					}

					nr_failed_pages += nr_subpages;
					goto out;
				} else if (!no_subpage_counting) {
					nr_failed++;
				}

				if (!no_subpage_counting)
					nr_failed++;
				nr_failed_pages += nr_subpages;
				goto out;
			case -EAGAIN:
				if (is_thp) {
				if (is_thp)
					thp_retry++;
					break;
				}
				else
					retry++;
				break;
			case MIGRATEPAGE_SUCCESS:
				nr_succeeded += nr_subpages;
				if (is_thp) {
				if (is_thp)
					nr_thp_succeeded++;
				break;
				}
				break;
			default:
				/*
				 * Permanent failure (-EBUSY, etc.):
@@ -1462,14 +1453,11 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
				 * removed from migration page list and not
				 * retried in the next outer loop.
				 */
				if (is_thp) {
				if (is_thp)
					nr_thp_failed++;
					nr_failed_pages += nr_subpages;
					break;
				}

				if (!no_subpage_counting)
				else if (!no_subpage_counting)
					nr_failed++;

				nr_failed_pages += nr_subpages;
				break;
			}