From patchwork Mon Dec 4 10:20:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13478085 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 D651EC4167B for ; Mon, 4 Dec 2023 10:20:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 740016B0275; Mon, 4 Dec 2023 05:20:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C6C86B0276; Mon, 4 Dec 2023 05:20:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 519506B0279; Mon, 4 Dec 2023 05:20:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3E8E96B0275 for ; Mon, 4 Dec 2023 05:20:58 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1876E1C02B0 for ; Mon, 4 Dec 2023 10:20:58 +0000 (UTC) X-FDA: 81528742596.25.054191F Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf28.hostedemail.com (Postfix) with ESMTP id 80583C001A for ; Mon, 4 Dec 2023 10:20:55 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf28.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701685255; 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=CJPAGE1/3ISw+ze65bWQIzZEE2gBo8Dj89YFaGopP8Q=; b=vL4ALRpqq3T1fxMhs2ocC6DP1+Zz2uAlnMDYxAJPfZ13LxbX+Ij2r0WJICcvrcSgcceovo uySd+eblQYtE2VyNWtdClHggkwopvhcGignE/HO7SPOeWX8wHdLexIcmUGRWNsy+wCzgLF YmHwGjv6G7iBPaSdphhLod4YcXtuvdo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf28.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701685255; a=rsa-sha256; cv=none; b=EL2IwQqXJ5FQz7YAj70dCzYEmc80DoX9KGWB5SHi3zI0R8fHq7gQk4RLg3m20n3BcE3FJx h5Yxj67KcoAKlNtGOrZ800+9DIyA2G8VulP7Q/ZArsqnOPs9uEGiWAGUPmip+GHAndr4Kp F4b/v/I2sYgAYF8KkY9T62HJpHn9jqo= 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 E434C1684; Mon, 4 Dec 2023 02:21:41 -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 B24C13F6C4; Mon, 4 Dec 2023 02:20:51 -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 v8 01/10] mm: Allow deferred splitting of arbitrary anon large folios Date: Mon, 4 Dec 2023 10:20:18 +0000 Message-Id: <20231204102027.57185-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204102027.57185-1-ryan.roberts@arm.com> References: <20231204102027.57185-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 80583C001A X-Stat-Signature: bm83j465zqq3rmczee1hquddkbkmw6ej X-HE-Tag: 1701685255-316677 X-HE-Meta: U2FsdGVkX19sZVKoRoLDFWuem6CeRVb2RR37gjLgM7uCVccOPqhY9v2QghYy0dDA50jtVs1Q4zFKkvYjdfV0xB5sLDWz5C/4HXCGXHPaomlAurD1M+N48P2Rm58BMvEFNSDr0rmyjMrgtNP3mynBkCi8sZrTeUdY1i+TSCSF8pItuZSVmWa9453PxRbKOr6JSpRKiF+6Zv3Opz4MwBmUswG+xk9dk1orIT6RPsvFg8oBCCKRQrJDK9hvT2w88iY0PwZByX76kvx5CvZ7TvUdLd3/ISR3p48untGP+0bPyMXQReWSGXAggATJDFhEZ6bosj7W9GIohXjN77VEYxXbmzuqi+97Nlr2deZnX2Oyi8PfySoZuTfce0arA711vEcNm8qBHrSBDjtJdNPPoB9mWZc3+r/bzHTIkqSiE7iFO6+3ZEfICa4c/yuO6lD1xwQqqhrRNzMcbw5HSauqJRqC77oBOUaHlj6XFhroGSa1KZ6WtMUA0EEJvn+0cslSt8Br8JHK16Jwds3DiguNQJkNX0tYJ32OLIaYbsxFj0zYZuZtwtEsYvIuQQ28q3Ap/BWILjYS4KQRaby2B28L4eVjzenY6Tcp1v0C8rNkO/pQyOe2PZO3ySZELjJw2DoBHWUqQ0iZV2iGPuzX/3SBESp743958Lnn0uykIAfd8WAmtYobKf+XsZRvNxARsp0HTvY/i9v9Xs6uZH6Q0aBEGqzuL17rdbdH0ZlApTeY2wNklOdk5q9yeKM2bbmvPRUmzs3x+0W1sWYWE7IdN6xcKniopyloRaYWhUu+AjvwFScaw664B//FKJ++Qn5pekni87fWzLRcott5eO5kTndmu30u7TA1Yp3vyREot2+kNCU83WlbFt2KMuuQb+wWFN7H4Q8OWNGEE1YdF/o0t06w1cubfYWKk1jymloTeWPkbdae3L0Q6rc3kRp7Tvw95YAYb4ga81HeQ9CRyddJj+VNSBz zYx6jzSP ueoUgFANcCs/mPgVBIKmXJ1boiNiEZOnSNgDD6t5xrbPVrXz2Sd6fwypTlsthKGz+9D1ntQ2K7l2NvTRjW6wJVOrHFrJlrXNI01gbf0DVWOUSwHCMGhk8nnRUE2Yoc/sXTtl01+kyOnOtxL5ZtsKtOAV392paOezEpMzlsVzY3OwhQwiRIMhj/1ji8dvRdip0el5LRiqrGek37+EIZeJfGuHa8NcpgcbHv8zC2vnwCaB3+apzdqqkqBwO8PNxFW7SFbe8hPE1Esez2Ev1csujqyXY70ofTESXKrdVEXwujuokHA9foqvNeRNeaKCD7obUABRsmLBOjf8bAdM0Q7ak/aG5MBbN7ORL+YOVoQtdROOoYC1SFx3nLvqHbOz3A5eQYPYEqtA04j6/oAOwn4x6BUR9qhtA/42ObJAS 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 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); }