Received: by 2002:a05:6a10:87d6:0:0:0:0 with SMTP id g22csp655389pxr; Mon, 11 Apr 2022 03:56:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpXn1AnLUxxYlrzcAa7n24JV9nzx7GzyoxeZWtJQIr72/WYjg5sla4ZqK1+mZIml3MugMu X-Received: by 2002:a17:907:eab:b0:6da:8ec5:d386 with SMTP id ho43-20020a1709070eab00b006da8ec5d386mr29423714ejc.668.1649674569067; Mon, 11 Apr 2022 03:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649674569; cv=none; d=google.com; s=arc-20160816; b=02VKxIla9E5NZeqBACDsS8aaCDFsRTQdati07AD90JOMAV0sgg5Z9cFGjJEHnVl9S0 SiAB2hkUFrFPo2plA2oIjucGx4E5uFZFoPdgH67mzHuXldrk8cT5cblkQsxNdIASgDHc R+LpfJBkqdQPpKQUGaMEeweLtnBR58V/DfKGFqVw3ZTYORg7B9lWrC1TCDM4w1YXaPYd YkPpZu9v96VkvzEMjdIXJjEg4sL9S2GB1HOqsvRqe6U2E6F3tTatqjS8kPt4g9FUPomP oA7tpAwEMm2YD9X6L+EJjNummBHdp3ND3Tfc2+38dE8r1DTBBrOZpq/QMEfGJN1zubMA NTUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=B42cnWZeIC6fqh2CnxxyPwpz94q5ZPOV8YfyWBoC4po=; b=vbhIXHf9Y9RBBzLUcIkw+q/PktHKNTr0BbIKFfbbnVMLQf5O4FSV6++8/KHARq+8Pc S4FDIMfQiA04LfOARwqORs0iQNkefp/zSZsFblnVU8u33s5d9+Vs/cqNPuAmTF1/UKzU CDaTFtOI4l/v3Ge4NF/TJ6atX5FSASRc7C7JvIs/Qd+ttX8mFhsGvsE5rg+DJeX4LOsE WVNMoHqXF4UAUW/FwV8jgVhvF+46fAV4nJsdyp7R2xyPsN4T5vLZ1ELUt05vNHzPdPrE YwyGICOtbfxsxzxM91eWDyf74F5x9ekedaopy9g2X/2qRYdSCmwQVpXIEqMXSsoHbms4 ahYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz7-20020a170906bb0700b006df7808f11fsi6614173ejb.913.2022.04.11.03.55.43; Mon, 11 Apr 2022 03:56:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241294AbiDIJgp (ORCPT + 99 others); Sat, 9 Apr 2022 05:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240756AbiDIJgi (ORCPT ); Sat, 9 Apr 2022 05:36:38 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 164FC51583 for ; Sat, 9 Apr 2022 02:34:32 -0700 (PDT) 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.23.0