From patchwork Mon Jul 3 13:53:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 115376 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp543809vqx; Mon, 3 Jul 2023 07:00:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlF8ELrabh8t8I/tCn1tD6JiuzrlGgwZwybRL1oG5yJYFYJwx3yOnFaHf8HqkNgLG66S7cVv X-Received: by 2002:a05:6a00:280a:b0:676:2a5c:7bc5 with SMTP id bl10-20020a056a00280a00b006762a5c7bc5mr11850014pfb.1.1688392817617; Mon, 03 Jul 2023 07:00:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688392817; cv=none; d=google.com; s=arc-20160816; b=by+nOyG0fuyubRXYI2uB3TnULuFN3Z4rmQwohlzidr4fTafnpBGn+PtCY+nnZHzl1x WwK5OzSQUmkjKyea/udFNHgOccqLr2GQzocQ0VVy4Z2O0cH7HiIES0pmnsMjWgF7LFsg 2N7n/f2pVO9BVa8aV/rNJehTOZiWQaqhZv8QbFLqqF2NO6pm/1M6oveW6Faqbf+t3yy4 q2RaNGDBj6AkwK7JpLno/gkgcBc1u0WvmMWWVlLeqr9Jc1Q3LhAp4lcbf/SLtRCezYI8 gACG2dV46QMe6h9yhJJt0ZVAM7oPREb4kDGM4c619cadEWIoAt6v03TAkJvMijRTFkEX nILg== 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=qDlU2rGsKBPfwZSw0bLPzWmjupT8xRy+8rDXmR7/VPM=; fh=W2gTym8Tes+4XZMJyNdq9yGC4n1yJ+vTSxJnRC1NAwA=; b=xxXd3AkQciKtwCxEPzEAvtm4lK0B8f0bRUuVC+vRUFzpiYZ4pdMeSmT8C3XrDKOm2U oA5gBNsLOzFBJStTUs5y6e345dWUA+kQnfn7az0fqlXHoNSBpPKbarNb2zMy3AVEwcte qh7fcdcrYstw/7EnPF1dfjR+1l1A38D5HK46P/yB3hHE7RpCMEaq1Xmu+E/Al9BSxWby 2tiZV2zjArOw0PtAS0zstHha/cYV8oBiXw/jE/s/Aqqol+oeY/p0ngFF5vyCvAzxfDsq URDVoHauTILt6W+lbEG13pAn17Rxws7xnU2pe8l20WGPy5Z2zj9KD2r+wvBfTfi/J19w SFsA== 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=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020a056a000cd500b0067c2b7b23e3si13719076pfv.345.2023.07.03.06.59.51; Mon, 03 Jul 2023 07:00:17 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbjGCNx7 (ORCPT + 99 others); Mon, 3 Jul 2023 09:53:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbjGCNx4 (ORCPT ); Mon, 3 Jul 2023 09:53:56 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEBF310D9 for ; Mon, 3 Jul 2023 06:53:46 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6A42A1424; Mon, 3 Jul 2023 06:54:29 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E6A393F73F; Mon, 3 Jul 2023 06:53:44 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , "Kirill A. Shutemov" , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Will Deacon , Anshuman Khandual , Yang Shi Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 2/5] mm: Allow deferred splitting of arbitrary large anon folios Date: Mon, 3 Jul 2023 14:53:27 +0100 Message-Id: <20230703135330.1865927-3-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230703135330.1865927-1-ryan.roberts@arm.com> References: <20230703135330.1865927-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770408187148080429?= X-GMAIL-MSGID: =?utf-8?q?1770408187148080429?= With the introduction of large folios for anonymous memory, we would like to be able to split them when they have unmapped subpages, in order to free those unused pages under memory pressure. So remove the artificial requirement that the large folio needed to be at least PMD-sized. Signed-off-by: Ryan Roberts Reviewed-by: Yu Zhao Reviewed-by: Yin Fengwei --- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/rmap.c b/mm/rmap.c index 82ef5ba363d1..bbcb2308a1c5 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1474,7 +1474,7 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma, * page of the folio is unmapped and at least one page * is still mapped. */ - if (folio_test_pmd_mappable(folio) && folio_test_anon(folio)) + if (folio_test_large(folio) && folio_test_anon(folio)) if (!compound || nr < nr_pmdmapped) deferred_split_folio(folio); }