From patchwork Mon Jun 26 17:14:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 113062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7640625vqr; Mon, 26 Jun 2023 10:29:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KdZ/bRVUWYqrOrZ+PF1S1nU77tzFvbWzQ5Nlfv6RCk8HlQIajRi1jrKcYYWktnn9rMUR8 X-Received: by 2002:a17:907:26cb:b0:96f:e5af:ac5f with SMTP id bp11-20020a17090726cb00b0096fe5afac5fmr24727805ejc.47.1687800581782; Mon, 26 Jun 2023 10:29:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687800581; cv=none; d=google.com; s=arc-20160816; b=hyMb4ZXnndY0pm/rot7xg9TXJxh0MX6EbOyT0f2iCV24Aqouy6di8aIKBH4dPSLTya V50xigXy1XxjxsPyIos9KxgabBw/cd7o339S9d0br1u8nqmFN01uhQ8Jlkg3xZmURVU4 sgqIJt/nPNc9wtR1NnUYPectfky+QzP7oy8i2/5M7LF9aW9Vl7j2thL2XJI0C29TMN06 WpLUcbzHlFvuOMwLpOkxBFJwmoUpU0DCjcu9lC5tkm6Gh0YoHbRbGGX4/nlOKGZ+8tGO +U4cfbzdiISGmTPEhj9Ngs/ch9tQDra+ukd/89aeaiEAtgmN2gh6dJOl+nkGR4MurnD+ /aEQ== 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=9LDnxtcMGKzMwMeO2DGDBjGbhx12txEm8328niFWh5M=; fh=H2MVjBlipHVEN6kEAh1RDhnPLB9jpPNjGExTmo1/EvA=; b=nKA/X7wJ2qAMcdLUxkinRODrg0+l4YBB61gNqZxghnz/dH4Bfp9nd5Zm4K+BHVuoUP Mnj8HmIRxZLpB/egteN6jB8gWkSghhfMoHnHhIyFGa9bCYGPtcVumiCuYfC8JRTIYK8Y avG6yv6EiL75jGHtJoXS0vrUbZnBfLMONPU3xSdF+OEHORxLsLjW3IdiQ09RjLgDcaIW 7Aqh0wZUhuaFQ6+ySSmDevtBsgBBQP0+M8AffjJx29pdRjxWiyGsYXQdHO1aSH/NVaR0 C8jonXZICxNeo81mhiTgYB40Z7znEwgs5naGZp6foQvxJTjKhBQ9m+atYk0st4BJuX2G GGwg== 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 gq17-20020a170906e25100b0098e0c0cfb64si2677223ejb.111.2023.06.26.10.29.17; Mon, 26 Jun 2023 10:29:41 -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 S231305AbjFZRPp (ORCPT + 99 others); Mon, 26 Jun 2023 13:15:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231356AbjFZRPC (ORCPT ); Mon, 26 Jun 2023 13:15:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C05EB10F5; Mon, 26 Jun 2023 10:14:59 -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 94AD9152B; Mon, 26 Jun 2023 10:15:43 -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 AB7DB3F663; Mon, 26 Jun 2023 10:14:56 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Will Deacon , Geert Uytterhoeven , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-s390@vger.kernel.org Subject: [PATCH v1 06/10] mm: Allow deferred splitting of arbitrary large anon folios Date: Mon, 26 Jun 2023 18:14:26 +0100 Message-Id: <20230626171430.3167004-7-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230626171430.3167004-1-ryan.roberts@arm.com> References: <20230626171430.3167004-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?1769787183194393377?= X-GMAIL-MSGID: =?utf-8?q?1769787183194393377?= 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 ac1d93d43f2b..3d11c5fb6090 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1567,7 +1567,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); }