From patchwork Thu Dec 7 16:12:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13483616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24A0DC10F05 for ; Thu, 7 Dec 2023 16:12:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A88886B0096; Thu, 7 Dec 2023 11:12:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A11B86B009B; Thu, 7 Dec 2023 11:12:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83C686B009D; Thu, 7 Dec 2023 11:12:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6BA016B0096 for ; Thu, 7 Dec 2023 11:12:35 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 42FBCA014E for ; Thu, 7 Dec 2023 16:12:35 +0000 (UTC) X-FDA: 81540515070.25.6A5B967 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf05.hostedemail.com (Postfix) with ESMTP id 0C41510001F for ; Thu, 7 Dec 2023 16:12:31 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701965552; a=rsa-sha256; cv=none; b=cN6r0dLGNQQQXrpBCvlRnmOIAmmKHglPBkivcJyv6dOBwOmvFCGv1I1ShmzxlOvStwd2u0 tss00Wy+iTX3jFMADZi6iq5Tvz6xCQDeFB8ykI7rNBnSOVqA3ze2lEXrLbHANsD+AUdcFD FVr5axHiQOmJabQfss4v14CACWsQDFA= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701965552; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cyp2+duFiqny1Vb7Wmvt+l2bsRLoDB5lhrdMz8lR4Dg=; b=e2URJwDeQuK2KOAuRI4vBI1k7ugyIRmHmMB7N5JvEQiQMWOA4/2ZNWxOchwpu9/s6rc6TF rhZBo2HZ4iFZ323o/tOPoCaFaVsTMOt3CgpJRREcKaHtYDNQiERg/mepFfROA0yRw5wCsq 4OqBpGisslC36ddTitcyIMBaR8etksM= 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 A214A1570; Thu, 7 Dec 2023 08:13:16 -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 C03523F762; Thu, 7 Dec 2023 08:12:27 -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 , Barry Song <21cnbao@gmail.com>, Alistair Popple Cc: Ryan Roberts , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Barry Song Subject: [PATCH v9 01/10] mm: Allow deferred splitting of arbitrary anon large folios Date: Thu, 7 Dec 2023 16:12:02 +0000 Message-Id: <20231207161211.2374093-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231207161211.2374093-1-ryan.roberts@arm.com> References: <20231207161211.2374093-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0C41510001F X-Stat-Signature: f4axet871awt7c4bz5ou3gdebdmjxxz6 X-HE-Tag: 1701965551-188458 X-HE-Meta: U2FsdGVkX19UYFmNLGblU2hrHNfkUpTi+nPO8Jl2ONYVGZ4+aiHQrkkbykO8Mjg+fb76nOJ7oOdti0hrUSzRh377PRflCipoLjStXs8I7Z1zW7OsYilDR0pTRdYoBfswk5/KKhGKEp2bAEwx/9OY++ixGmE7ObQwFP/6/KLxTzTjQSrv7T0JQvu1HCBLTDBC7/dkYzx7/YutMUD9S19U5UVR8MgQ2zUfL2IFul+wBWuLe04fM3duOvLyEhTYeIaZKus0qnC1eIEJmfy2WK2yhEz9v4XCAx//pNjoj/8aLoLGDOQOULJchCMbcWaF3lKRHVLMCLjwnw/BGBMuVFqgNZe958TQtvC6at2ceqQ9HU+nUpzPY/UGzoN4DSaIFkuGTgDzITEBSUbsaR+voYX1sSNHSbiAZ+XqAJ8mKaG8KEWUpR97JfcFAWAhHjL3R176A4YM4AJN6o2PqfGdxEbcsmZqPP9TafBOSQldCzsaxZ/CjVG+XKShUBphwsn52i4Xd/rXKXprs5ZHdQO2IjyS2i7CuJzSRZQLSKlSEd9cx4d9y2YEJU/mj5QRAOiW3Oa2FJ4a7IO8PiHwLxeKkSpSILXvHPrpDwOJjSdNYtjR6fp5JuicGKKJgCeOmF7xDgZajNFoWqh5cbtDCn8QJDPewxgLI++bkB3aGczWwnTd9z1v3pRqYlOalAQUVb7Fsib01zeREKGBmJusbWhNr6xQGlW29cNbdaqcJN0AeNIxjwLcKhe1fVNVVS0Fc7bhqSl6shqFKFOZYzVKl3vkH8LHM+qXehpRFUKmmTo+17JJ/6lMcIKdiwP/avNz1vrz01gvtpavqfy4zn53+OewonI9SiT2RwA3i+8sL2WNJ0kI2CJrAzuOZx1UofUTjusMj4DIv1ffXae6Ip1S3wcVkuj5a2GDbzQZvOnobNLS2nxXoCoZE8qpnA97QNTrL839gd+JahpStncgaKkKlwqNEl3 Oivesa6U xhsAYKDKGuZfn9IgQr2GXX30i5QWLoMfHszWD+AT2w44uMOMa93e1+qkOlF/zbTKfVk+YM2CTDZfM7hULHxm6HmCC7w9cLmWQGY8XnojuIvXXI3O/eY3wnCms+boNUaeVvk2GUajJz5smTBsmQIQxKSI8HTtLvVnusQtbZOUg2GwP9E3FT/dYMjLWkFFC97+iqz9BYhN9asNgCWawCOUwXlsFtGKD+lQGZZFA5g4Ne/aygvppRwPEoo5sQ6ygB6nVAHrfKV1ngRhnLSrU43YDy1lzoqY5HsuNDH08j6QedTi4gYbjIEvjBWcrOQ3Si57GD4VLvKDZDy1RmaqG03TcHRli3PjToalhw56yudWllzTD6c3DQliGYKIQdptu7YISqKKehVty1tc0a0st/uSmVQHdj+z8kNpP6aERPnnJrKhLWCu0IPvY4F1/pIEhcUFsU6/3O5xnkB8CJdT9cjiDHHS1bw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In preparation for the introduction of anonymous multi-size 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 Reviewed-by: Barry Song Tested-by: Kefeng Wang Tested-by: John Hubbard 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 de9426ad0f1b..2a1e45e6419f 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1518,11 +1518,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); }