From patchwork Wed Nov 15 13:27:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 165353 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2535112vqg; Wed, 15 Nov 2023 05:28:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHP1/kQIf2mol4o9vcJbb2Of/vsT8HPAYHdUmPOLfxvel8z7A3SjARdGFcJOkw9Yzo4sYG+ X-Received: by 2002:a17:90b:1b04:b0:280:9427:1e8f with SMTP id nu4-20020a17090b1b0400b0028094271e8fmr10225333pjb.46.1700054889786; Wed, 15 Nov 2023 05:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700054889; cv=none; d=google.com; s=arc-20160816; b=iJYu9zktHCRjy3Ng5JEO/ePJowvlV4rlDTNTeDwKsyeWYnS+xwe9OZVuC3X/sua3W3 8D4YZjVHTx7iAnGNKS/OSnz6pVs2nTa88EuncNQD6RMXa/9EKV4RzvYtkBoYZ+foPWxx Zv4OE7qabPMOqpQa4eL+lWUcTsefj6X0KbMVf2ItQDm6oIdurEnZTdrPkJuWZiB+Uzca HHrEU2V7IV9lIX10eMRzxXT8ypEGBjX3D7kMc0FcbaURlY6AbT27HegU3GJB3PMB3rIG GNXwsuN/O6jUGLjR+ykdC7n3hfw0ker1y0/Grf5gp54JsB5dGC8x/lUuLHannBx6iBiN aPig== 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=uLiZitmjG+3foZ1+dsOMU1U8TEvwumUeFwfgKAb7Uhk=; fh=7axEUdnMUApK6aLYLrmxIYzEqwt8JUQTbtI9r8kD7PQ=; b=gjDtSXysCKJTHh+/g8cj+Tp+2L9UCBiVraNhBXeVinExY5yDEF/lACF3xcb5Xv7GCv We3TJEAvYD9UiuJc3d9mZmjvnLgUYxNiq/Nf4gCGi4ePCL3Bi+Y3Rx+iPuLHqU6LazTd tPL/FT/kDJ96ov191F2H4aDIHj9/wGDUlRv0Yvqbhiwego2zmUtYukoXU03qPym0IYM3 1WWSSppdeUbI/XO0K9Cb7FYn4ku2f8q9kH6XskBcow9b4li3Xc9ilUH0y/h3Upn9NwO/ wmE0HW5scoSjQPY21KXMqWZP3w8PyzdWYtUVI86OP2HJepOXF3CVSiPXediV9F54GckQ 5l2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id lx7-20020a17090b4b0700b002805a422743si10549952pjb.12.2023.11.15.05.28.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 05:28:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 54317819475F; Wed, 15 Nov 2023 05:28:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343884AbjKON2F (ORCPT + 28 others); Wed, 15 Nov 2023 08:28:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343852AbjKON2D (ORCPT ); Wed, 15 Nov 2023 08:28:03 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C31468F for ; Wed, 15 Nov 2023 05:28:00 -0800 (PST) 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 1E2AC1595; Wed, 15 Nov 2023 05:28:46 -0800 (PST) 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 A7A3F3F7B4; Wed, 15 Nov 2023 05:27:57 -0800 (PST) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins , Kefeng Wang Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 01/10] mm: Allow deferred splitting of arbitrary anon large folios Date: Wed, 15 Nov 2023 13:27:25 +0000 Message-Id: <20231115132734.931023-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231115132734.931023-1-ryan.roberts@arm.com> References: <20231115132734.931023-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 05:28:08 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782636756034063977 X-GMAIL-MSGID: 1782636756034063977 In preparation for the introduction of anonymous small-sized THP, 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. Reviewed-by: Yu Zhao Reviewed-by: Yin Fengwei Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: David Hildenbrand Signed-off-by: Ryan Roberts --- mm/rmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 7a27a2b41802..49e4d86a4f70 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1488,11 +1488,11 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma, __lruvec_stat_mod_folio(folio, idx, -nr); /* - * Queue anon THP for deferred split if at least one + * Queue anon large folio for deferred split if at least one * 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); }