From nobody Mon May 11 01:27:32 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD575C433FE for ; Tue, 19 Apr 2022 12:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352243AbiDSMYx (ORCPT ); Tue, 19 Apr 2022 08:24:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352231AbiDSMYv (ORCPT ); Tue, 19 Apr 2022 08:24:51 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF1335DEC for ; Tue, 19 Apr 2022 05:22:09 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KjNFc0B9bz1J9km; Tue, 19 Apr 2022 20:21:24 +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.2375.24; Tue, 19 Apr 2022 20:22:07 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH] mm/mempolicy: clean up the code logic in queue_pages_pte_range Date: Tue, 19 Apr 2022 20:22:34 +0800 Message-ID: <20220419122234.45083-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since commit e5947d23edd8 ("mm: mempolicy: don't have to split pmd for huge zero page"), THP is never splited in queue_pages_pmd. Thus 2 is never returned now. We can remove such unnecessary ret !=3D 2 check and clean up the relevant comment. Minor improvements in readability. Signed-off-by: Miaohe Lin Acked-by: David Rientjes Acked-by: Michal Hocko Reviewed-by: Yang Shi --- mm/mempolicy.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 75a8b247f631..3934476fb708 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -441,12 +441,11 @@ static inline bool queue_pages_required(struct page *= page, } =20 /* - * queue_pages_pmd() has four possible return values: + * queue_pages_pmd() has three possible return values: * 0 - pages are placed on the right node or queued successfully, or * special page is met, i.e. huge zero page. * 1 - there is unmovable page, and MPOL_MF_MOVE* & MPOL_MF_STRICT were * specified. - * 2 - THP was split. * -EIO - is migration entry or only MPOL_MF_STRICT was specified and an * existing page was already on a node that does not follow the * policy. @@ -508,18 +507,13 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned= long addr, struct page *page; struct queue_pages *qp =3D walk->private; unsigned long flags =3D qp->flags; - int ret; bool has_unmovable =3D false; pte_t *pte, *mapped_pte; spinlock_t *ptl; =20 ptl =3D pmd_trans_huge_lock(pmd, vma); - if (ptl) { - ret =3D queue_pages_pmd(pmd, ptl, addr, end, walk); - if (ret !=3D 2) - return ret; - } - /* THP was split, fall through to pte walk */ + if (ptl) + return queue_pages_pmd(pmd, ptl, addr, end, walk); =20 if (pmd_trans_unstable(pmd)) return 0; --=20 2.23.0