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: 13456675 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 9B20FC48BFA for ; Wed, 15 Nov 2023 13:28:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37A066B033B; Wed, 15 Nov 2023 08:28:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3294C6B033C; Wed, 15 Nov 2023 08:28:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F23A6B033D; Wed, 15 Nov 2023 08:28:04 -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 0CF936B033B for ; Wed, 15 Nov 2023 08:28:04 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DA25AB5D54 for ; Wed, 15 Nov 2023 13:28:03 +0000 (UTC) X-FDA: 81460266846.26.A2A8882 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf17.hostedemail.com (Postfix) with ESMTP id 510E44001D for ; Wed, 15 Nov 2023 13:28:01 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf17.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=1700054881; 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=uLiZitmjG+3foZ1+dsOMU1U8TEvwumUeFwfgKAb7Uhk=; b=p9m17XuBKBkykdg3Bh6Ocj0LhLDEU7nTmxX1GsgcYMn2pBGFsJ4Wrpb+aWB85A0bfqgYC2 wH+aC26b1vf5E67DEYR9Y5cBAtgAnS8TeSXHV4YXMU/ohj/q3aPWUHrucBkEuuJ59/FR8W 0nTWGsXdcNHsCOmF14C9b4BUxOHwizQ= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf17.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=1700054881; a=rsa-sha256; cv=none; b=ad0MFClg9gS3lxQhV+ZdDPoUA9MiyYDJam6ymw4KPft3qOk1PupObop0dItFi2p/T2BpqF zndq2wfj4beaoLR/7QeX67pqpt7l7CjNlqJy3jyWgL1zqed99TmVcwUGAcraXZiSLGQoaH P3V1i3QJsllnhzWrF3KgV5WckGro7IM= 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-Rspamd-Queue-Id: 510E44001D X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ykjjnyx59kpiaix7y9ot1m7j771ourhr X-HE-Tag: 1700054881-401489 X-HE-Meta: U2FsdGVkX1+ENK2cOO01DZfT6cudlcXSMd8cYKnMT7dBnDgkbOP5veQpocTxXQ8KpPu78qwWGj4omCWxNTIgBsbNKJ2FB0A1C9MI+ySna5QiDHldWue5z0xO5htJEMLZtg5q8IVz2NuRS1bSgWKtR95Bc9x5uAjHRFp6u9PrRUoGLWyeFPuoA2Sdt6hQzECY91eYKZog33HH3/KSR+SDgQDTzqBicNrg9DNwrQb5iZckFSLzuuBongkDS9NmLQfAmMLNvlmJUgNpVQepyEuP4twT/HAPMnYV2LHsEodkNfbeD4h1LDpphQkqvQIzba7ZeggZSAnVuEbEDuJd1Q0iv2FfubMxfL8Q3jmCdm5S9iSpBX7CYhpzSR/6mC0s0/+5vd+mrxYisQo9lB03N4uKMdIi137+BR4fUtFBE0+EY8vJ3SsLW+9gxETeUrSSgn8EheGBVypa4J+LcZTx5YB00St2jp7XbNAIQbtrTfKiCJE1GVG/EVTKnZExEKTpXvCmlBTtLUhvBwkxLPS9Inu0zt3Qzd5Ux/CwnvENAk/ebFu9JgY82mrjFCJUu1NjdAly/erGdS3AiQma05JgUQCd2g4HaAKhTll5OE/y6lqKPp6yWZ+bKDY6++oF2zHxMzKnfqERUn0sPZ4OdBaMiNVioP+nKfCE4+iHDh4XYS4+fWCVtyLCurS4H+7XRSIm5zEXHxXB251wWnPz/ODN8/wy++SzrbwBrnVuky3E+ED71aaI4MVg+ukySKQ/DQvTYl+aBsR5FXO4VZoWh6qxHmaTgvFogqBkP2w/Vf2aEmyTSnB+ZdpAPnPO1/3cNLggknzZWUU0f1po4oNByG24aIJxceJ3b3QGIKat26o15oKKU3ccEgliZpp6BHmda64xmsgnQJ/gKweFEsz14wTMfeiy7EvQtFPoeLTR5LZa130FUpHR1UCX0Qe1MBeR4x+73PT5gRWPEGS1onGlB5sCIjk jeip4NOD VhflZYk2Y+MlpvjCmvwaECHqb2IF282wm9VFkP/3W4vfXEhIDQXlkft0OD1y3kWk29S5BnGYqqY5rnQlkfGCnxo6nPAp/uK370UvQHleQyoRUkp7wfH56Ym7/cPHZ3QlEjYQRyP0bd3I6EQ7nfqheZrp5gYohnxWiHUHiizovKqqhDiTm+Wf6DbOXZHextbcOLUr6TRl3FU//OXDv5Ks1YZl4g8iGakwKKUZWhkQAM8vPnNMo0c3hOqlCf0TkFr2v8SSNm3bgbiYRE8RbyKsKgHdOVbC+MoospqJ6w5do0PcYS5pO+8FIi5kQCehqrqwWZUFf0rOv2HEqi7rJG4uzR3L/fjvp7vdxXc74 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 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); }