From patchwork Fri Sep 29 11:44:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 146507 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3963145vqu; Fri, 29 Sep 2023 04:48:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXuYmiiR1JdrmaDYHHuePnBxqz8oxfiqasGn6v55WbTDE+xXvARI/5uDk0MXTxBHmvMjqf X-Received: by 2002:a05:6a20:12cd:b0:151:35ad:f327 with SMTP id v13-20020a056a2012cd00b0015135adf327mr4421308pzg.17.1695988134806; Fri, 29 Sep 2023 04:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695988134; cv=none; d=google.com; s=arc-20160816; b=N+OC6qRmSk+te2EL5VtErulvj2Z2GF2PEKQJKdfk7HiyVNE8Uwhpbugy7tjCOmC0D4 7fZAdvmcocB0370e/nNepNi1iPocz1IcBZV+Qk6efEyahTAdOEvMlF/yiBmlCfk79Sts wNoXcppw7DpRxVvQzr+8JbXbpJ4cbkVX8qZBHYYiCr4nDF/zoBZE50kwZkC5WWaT7YTJ /FRnCqjWMAvPdyaJvqXQShPHaOFuRty3Y0fbiwf1yDwuD6XQrTOAaZgbFEMz9xzFpNo3 Jeah8z1ZdusQB6CohfadSt56C5CzA5h/MHKAJVgvzDcaJVgvThHCDbEhcyGARbtuUYKe dPRA== 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=wW8PmLeN+NODDjeW+k+loXBT9eKUllZt4ss/4twQx6U=; fh=smwoDWwCmhzJYttwqG7Q1aXJ58+o1gEThPYfICPOx+Y=; b=EQ/V98t/swrsB1slV4ysGuYYXyg1yMyyLYEdCtuOe90bOQJ03HkwKk2YEjNLNFcLof vJDUAUTorRKEyDlxLwDdYv9r/SkturxZKOWnP29NfCV8AeE0z432uhLTl9xSXPSO0KR/ uG2AdFkS6esMcilRHDG5f/DYnEyhk029lvR0fhj+1BaVg8eIEWOBuN7aC2594xdFzNe9 WUeY1puodbwlurFegW+eId/Ewek4+AxUlQAs4UQAuuvXz358umsSKF+Zo2VDIWp0x0Mk ACEnhtgAlfHXzp/d+deAVhtxEiDIRrs0+PZLTTF254c6YKRbHmmGdsC6rG53rQ173Tqf joBA== 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 mh6-20020a17090b4ac600b002736ff3cc79si1576021pjb.23.2023.09.29.04.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 04:48:54 -0700 (PDT) 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 404A7831556D; Fri, 29 Sep 2023 04:44:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233000AbjI2Loj (ORCPT + 20 others); Fri, 29 Sep 2023 07:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232925AbjI2Loh (ORCPT ); Fri, 29 Sep 2023 07:44:37 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5F31CE7 for ; Fri, 29 Sep 2023 04:44:36 -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 77FA4DA7; Fri, 29 Sep 2023 04:45:14 -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 94DAD3F59C; Fri, 29 Sep 2023 04:44:33 -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" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins Cc: Ryan Roberts , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v6 1/9] mm: Allow deferred splitting of arbitrary anon large folios Date: Fri, 29 Sep 2023 12:44:12 +0100 Message-Id: <20230929114421.3761121-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230929114421.3761121-1-ryan.roberts@arm.com> References: <20230929114421.3761121-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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 04:44:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778372454420897229 X-GMAIL-MSGID: 1778372454420897229 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 9f795b93cf40..8600bd029acf 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); }