From patchwork Sat Apr 9 09:34:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12807800 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 59D90C433EF for ; Sat, 9 Apr 2022 09:34:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E47F56B0073; Sat, 9 Apr 2022 05:34:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF86E6B0071; Sat, 9 Apr 2022 05:34:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C497D6B0074; Sat, 9 Apr 2022 05:34:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id B873E6B0071 for ; Sat, 9 Apr 2022 05:34:35 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7BF8861A62 for ; Sat, 9 Apr 2022 09:34:35 +0000 (UTC) X-FDA: 79336830510.20.A203BA3 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf04.hostedemail.com (Postfix) with ESMTP id B121F40002 for ; Sat, 9 Apr 2022 09:34:34 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kb8zb3pxBzgY9K; Sat, 9 Apr 2022 17:32:43 +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; Sat, 9 Apr 2022 17:34:29 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH v2 2/9] mm/vmscan: remove unneeded can_split_huge_page check Date: Sat, 9 Apr 2022 17:34:53 +0800 Message-ID: <20220409093500.10329-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220409093500.10329-1-linmiaohe@huawei.com> References: <20220409093500.10329-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B121F40002 X-Stat-Signature: rd7gqy79owrb5t7joceojts1urtxe47f Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.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-Rspam-User: X-HE-Tag: 1649496874-262489 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: We don't need to check can_split_folio() because folio_maybe_dma_pinned() is checked before. It will avoid the long term pinned pages to be swapped out. And we can live with short term pinned pages. Without can_split_folio checking we can simplify the code. Also activate_locked can be changed to keep_locked as it's just short term pinning. Suggested-by: Huang, Ying Signed-off-by: Miaohe Lin Reviewed-by: Huang, Ying --- mm/vmscan.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 4a76be47bed1..01f5db75a507 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1711,20 +1711,14 @@ static unsigned int shrink_page_list(struct list_head *page_list, goto keep_locked; if (folio_maybe_dma_pinned(folio)) goto keep_locked; - if (PageTransHuge(page)) { - /* cannot split THP, skip it */ - if (!can_split_folio(folio, NULL)) - goto activate_locked; - /* - * Split pages without a PMD map right - * away. Chances are some or all of the - * tail pages can be freed without IO. - */ - if (!folio_entire_mapcount(folio) && - split_folio_to_list(folio, - page_list)) - goto activate_locked; - } + /* + * Split pages without a PMD map right + * away. Chances are some or all of the + * tail pages can be freed without IO. + */ + if (PageTransHuge(page) && !folio_entire_mapcount(folio) && + split_folio_to_list(folio, page_list)) + goto keep_locked; if (!add_to_swap(page)) { if (!PageTransHuge(page)) goto activate_locked_split;