From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B951C433F5 for ; Fri, 4 Mar 2022 09:35:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 525438D000C; Fri, 4 Mar 2022 04:35:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D40E8D0005; Fri, 4 Mar 2022 04:35:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39DB58D000C; Fri, 4 Mar 2022 04:35:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id 2883C8D0005 for ; Fri, 4 Mar 2022 04:35:09 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D86388249980 for ; Fri, 4 Mar 2022 09:35:08 +0000 (UTC) X-FDA: 79206195096.23.3F411EB Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf23.hostedemail.com (Postfix) with ESMTP id 432B414000F for ; Fri, 4 Mar 2022 09:35:08 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4K92jR0dhfzdg7F; Fri, 4 Mar 2022 17:33:47 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 4 Mar 2022 17:35:05 +0800 From: Miaohe Lin To: CC: , , , , , , , , , , , , , , , , , , Subject: [PATCH 09/16] mm/migration: remove some duplicated codes in migrate_pages Date: Fri, 4 Mar 2022 17:34:02 +0800 Message-ID: <20220304093409.25829-10-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220304093409.25829-1-linmiaohe@huawei.com> References: <20220304093409.25829-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 432B414000F X-Stat-Signature: oqwt4i7guu7345gmex5b164w97647hpm X-Rspam-User: Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam07 X-HE-Tag: 1646386508-66115 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Remove the duplicated codes in migrate_pages to simplify the code. Minor readability improvement. No functional change intended. Signed-off-by: Miaohe Lin --- mm/migrate.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index abb0c6715e1f..cb970d201147 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1414,14 +1414,11 @@ int migrate_pages(struct list_head *from, new_pag= e_t get_new_page, nr_thp_split++; goto retry; } - - nr_failed_pages +=3D nr_subpages; - break; - } - /* Hugetlb migration is unsupported */ - if (!no_subpage_counting) + } else if (!no_subpage_counting) { nr_failed++; + } + nr_failed_pages +=3D nr_subpages; break; case -ENOMEM: @@ -1436,28 +1433,22 @@ int migrate_pages(struct list_head *from, new_pag= e_t get_new_page, nr_thp_split++; goto retry; } - - nr_failed_pages +=3D nr_subpages; - goto out; + } else if (!no_subpage_counting) { + nr_failed++; } =20 - if (!no_subpage_counting) - nr_failed++; nr_failed_pages +=3D nr_subpages; goto out; case -EAGAIN: - if (is_thp) { + if (is_thp) thp_retry++; - break; - } - retry++; + else + retry++; break; case MIGRATEPAGE_SUCCESS: nr_succeeded +=3D nr_subpages; - if (is_thp) { + if (is_thp) nr_thp_succeeded++; - break; - } break; default: /* @@ -1466,14 +1457,11 @@ int migrate_pages(struct list_head *from, new_pag= e_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 +=3D nr_subpages; - break; - } - - if (!no_subpage_counting) + else if (!no_subpage_counting) nr_failed++; + nr_failed_pages +=3D nr_subpages; break; } --=20 2.23.0