From patchwork Mon Jul 17 14:31:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 121399 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1181653vqt; Mon, 17 Jul 2023 08:28:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlGodZccFiOW1UXsOu1PdTFPKxp3iWyCZGvbQtxLVLQxB/eLUMzHWEMwGrGcfi7zbj50VQ9P X-Received: by 2002:a05:6a21:585:b0:135:26ad:132 with SMTP id lw5-20020a056a21058500b0013526ad0132mr1221077pzb.7.1689607731472; Mon, 17 Jul 2023 08:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689607731; cv=none; d=google.com; s=arc-20160816; b=QJHW4KHG6cVDnz5onsIqjZj74ZoQPvzptiyoBqxmEZa/BpvFq458GaYRdMFYuLfRzz 0MXiEBb9HF7j3BzkALKl7TcZSVbkA6yFAHKGXrIx89tcriMso6Jd9o5XOQIXn6oSg25u W3SwdE9dKWsqgJWeEQyiwOINYxWbsY4BhDjftXOPlSXL5sUwcZ8DBNS7FC4E8dNFQGFH Nas5NxMz0rrjfs3qxcUjP/LxyjXkWnxOE528oPuCdJA82lWH0gm1cNplqPX7hODIRzKx LkRlsoKRF2QlN3I8oWfWaCZ4GmDewTdtF1UwRdDg+3d7RPRmar+3+GSyjYTqzdx4COSO K6Lw== 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=BP+7rStUqlpLuRykLENwCQmjiIT3a8ADMh8sshpsKms=; fh=THi7eKCjaWcVibUnyL3CTjC3PwRMYqk9JChFkSe1vn0=; b=KyKXKN2hTfcFhQavargdESexq08tbthOljt5wpegU2usmYnwcZkwYxxGaaX0+W5jWg Iy2VpiwkhoGk4K2w3UVBOWyV54yH6rSfR6hXuDhVy4l0V/PvcEHy2dFUbE2bSyDLzMY5 j4ILYfDHmVhAw+oA+t2mTkUeRnZeIZxPMtwNHgS8qyoIuljxqWCWGMtngHmisBuJjJhs 8vCkUG3YLB9Gm1YLC3L2lglPaVzUh146d0QZUg3KkOTZpw1St1ZiTus4LJycVcRhP3lj D8M2pj5GBcUo355kXclHw8riuPtGZ0LrlCvH5Ew+E77FAfsNMnPmuAgw6U3S+k6joBpQ W4sQ== 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 s28-20020a63525c000000b0055bc97cc885si11482406pgl.614.2023.07.17.08.28.37; Mon, 17 Jul 2023 08:28:51 -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 S231410AbjGQObd (ORCPT + 99 others); Mon, 17 Jul 2023 10:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231343AbjGQOb2 (ORCPT ); Mon, 17 Jul 2023 10:31:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C3CAFE55 for ; Mon, 17 Jul 2023 07:31:23 -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 8D926D75; Mon, 17 Jul 2023 07:32:06 -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 9E0313F738; Mon, 17 Jul 2023 07:31:21 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Yang Shi , "Huang, Ying" , Zi Yan Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 1/3] mm: Allow deferred splitting of arbitrary large anon folios Date: Mon, 17 Jul 2023 15:31:08 +0100 Message-Id: <20230717143110.260162-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717143110.260162-1-ryan.roberts@arm.com> References: <20230717143110.260162-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: INBOX X-GMAIL-THRID: 1771682116517418783 X-GMAIL-MSGID: 1771682116517418783 In preparation for 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 Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand --- mm/rmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/rmap.c b/mm/rmap.c index 0c0d8857dfce..2baf57d65c23 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1430,7 +1430,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); }