From patchwork Thu Aug 10 14:29:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 134020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp476293vqi; Thu, 10 Aug 2023 07:55:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEawhT6hiokskcl4sU/GTnMUdvnV76tEIjUUb5OsHJfAfNHWtOLEaqrAQxQcNQIxpgtUaFb X-Received: by 2002:a17:907:72ce:b0:993:da5f:5a9b with SMTP id du14-20020a17090772ce00b00993da5f5a9bmr3055033ejc.8.1691679318413; Thu, 10 Aug 2023 07:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691679318; cv=none; d=google.com; s=arc-20160816; b=Nkiq+xdSu3yq6ODlrMFf1UBlab0UkgY8rQxRtuiOXV827oWWpqRcY2PYjXdnT+ixqp 43hIwXWIM3wHtaUTmEpDBU7KXjATrWfn/kXCpTvX7iglOzKlJm+q1/GkyWkqyd580rMB ySbykYpP1kljCLcY1ae9wlDZLccK1cyGI4vAi7qBimLHokXz8ViiL5fL/YeuD4ojv4EM bjhpHHhCiRiYHp2YFrus08VIoPneD5P0euE6Mdsr35wDXtxH9mTUBjCXtQxbQvansp/9 mt5eQLAXnruH/U5P5Cie6stc04AR8T0NJQYBjOLkYr8jNnTmLREopwqi9QtqS4XOFl19 1AmQ== 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=jjkXyBj141BxTPIAchOKJ6WjdJR6TzI9YqXc7Ba2Scc=; fh=2S5jT4dIIqOhOs7q3j0K2DFa5C1ZmfWI8H2ybAUe/oA=; b=bWrF9tWeyLRtz41jIUWDPvBLGKryHyQN5aSkkyvC9cOqvSvgfpQ12P6HcTBgH6EzrL jF35ENqHs7aiDYh12CwAG4WsP+D6Vlx0rJ+SOcvGU9Q5OBBYWtPV2fyTvxWCIVvKX43a 752mBD2ex4iAOtObfghad0+MxYp+BzEs2G6pGvE404GLft4fss7HK766pTpuFS/qIH+0 OayHIxz9yJqLVwXf6atpzV3VTiBsEZg1weGcjIct0gxxAzog8A1Imwt1XxP3czoXxlg3 ggYlJud8IqKH2hoYfKK5j3kLVK+Z/OdutaCGEKyPh7CMFn3Iu2CPxLVCF1+DAaperWdl 4hDA== 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 h19-20020a170906591300b009930d9d6b4csi1563219ejq.888.2023.08.10.07.54.51; Thu, 10 Aug 2023 07:55:18 -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 S235728AbjHJOaA (ORCPT + 99 others); Thu, 10 Aug 2023 10:30:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235706AbjHJO35 (ORCPT ); Thu, 10 Aug 2023 10:29:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B9E6126BD for ; Thu, 10 Aug 2023 07:29:55 -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 D9B95113E; Thu, 10 Aug 2023 07:30:37 -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 288DB3F64C; Thu, 10 Aug 2023 07:29:53 -0700 (PDT) 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" Cc: Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 1/5] mm: Allow deferred splitting of arbitrary large anon folios Date: Thu, 10 Aug 2023 15:29:38 +0100 Message-Id: <20230810142942.3169679-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230810142942.3169679-1-ryan.roberts@arm.com> References: <20230810142942.3169679-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 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: 1773854333047527547 X-GMAIL-MSGID: 1773854333047527547 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. 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 1f04debdc87a..769fcabc6c56 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1446,11 +1446,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); }