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: 13349526 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 68A90C04A6A for ; Thu, 10 Aug 2023 14:30:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E31F26B0072; Thu, 10 Aug 2023 10:29:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE1F76B0075; Thu, 10 Aug 2023 10:29:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD11A6B0078; Thu, 10 Aug 2023 10:29:59 -0400 (EDT) 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 C10D76B0072 for ; Thu, 10 Aug 2023 10:29:59 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7422EA107B for ; Thu, 10 Aug 2023 14:29:59 +0000 (UTC) X-FDA: 81108429318.21.00186E8 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf02.hostedemail.com (Postfix) with ESMTP id 6A91980024 for ; Thu, 10 Aug 2023 14:29:56 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf02.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=1691677796; 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=jjkXyBj141BxTPIAchOKJ6WjdJR6TzI9YqXc7Ba2Scc=; b=WVeYBwuszMPF7/z0LGknlVZtRuafpL25WfEQVcnnvjhzlTd2UWRHA9J159ePfqWIb3zRD/ CDNstQal6w6HAUFaPLJdsrkv8XYTbH2Gb14pcygTsXdVyPVh/8PupFO9Q9zbJybXo7jJgu hnQk5fkLmbYZojjcPNWEjd9bRUXxJmM= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf02.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=1691677796; a=rsa-sha256; cv=none; b=QvotrUYfVrZHzgHDLlLFUxJHfICx4tE6PM7xSc+N58oXSq7XNgc3Q68PD84DaIAT9QZIv7 v/l23EzpWEV15p4XskZK6AE8Wb9FPsJ7c+KaN+0VML9LV5whT02km/H5ipXAxF9ng1MMwe /XILHAJKss1VS40VI8DNdpGbvxvI7HE= 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-Rspamd-Queue-Id: 6A91980024 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: 3pe8wf5oi6z5on3kps4t44zobfgxnk9n X-HE-Tag: 1691677796-278988 X-HE-Meta: U2FsdGVkX18yKh+odlrJ02EYuJc5StHSah8oiX2uIWJQI+tjymOlk147eORAdmEyS6k0FFoCGwbbcN2mnGpbemeosCvnmK0XT2CKfgLIF3wvr9eSDfnrh3qJBglITrx6LlqEsXVK43XGjr88QP/0BOLKyjhodnrs1Vd8/ZEhXR0bHVeW0uKMjB2rJOfAP4jglukM86YGniRA9yJE6ht7oq72mk7jknyjngpjrl4xtGJM3oUvAzfiuN5Ak9EzoR1dKyR4NZJhFp0NvieRM9bPcHFK3sIPrXyMr13hYNLq3DeVVQUfn7Qyec4jT+xK88TjXxCjFQXKS/w1BB52S/Jlpv2TxyJjLj3Zhny8ZGw2GZho8gQXMJK3herMhhyaoulP+rSFXBpLyVV2tdKyDobit4gw8/IZyTyg5Lk/at2MZfWyTJUfzUTjzfhfFqXOSdkB1Y7ImtcwJtrW7ZSxcbKODcrXxgkIGu0pw1X97CtYmQ6ktR7LIw6qbcaYkKdyS5R6TfVFc9NbdrCaNwmIH9X9Tkq3kq7I/eXoW94MUUAIi2DrC2ahG2eeYqw7TEm0mMjAwtzlnjqCdondq00BuTtPnqtyhegYDgf4+id8r92ivDJPIQgmdLl5pV3nKm3dWSIImrQ8DEJvWUzpr2VZgFjoTNV3UQ+7ANgYBsyosxoG4IwXeVXkggHnLvN0pfQYu7+1fu9TJPPyYkCHOZaq8jewK6Oykm4iLXvCjHUXQLIAUYLhhzPIWUKEwALpYhJmFghjfQzv1bZZpst6GdFaQG7j8HHaltMgA2s1Z505B0CPHuFjuxj33PESRcGT/b//1zyflVDGcaUHlibZqyGD9CX+jF/U/gMIOHNr48asoO0fnYSx+IPfmSxdBgK1uT4ByOGp6X5EXvar4Xy7Vu+3mJbAeD6AKi6lqnW7sXVg3r27IwRaIgoonAWSwFZObMlEJTNRDIf4EuAwvEZIpzVDaYL FUgQY8MF XuidDr/Remh+phZnEQboUM2uJJFlOE7nuQ2rsaNIgNgu0QsngAMaFvV6jUFvLZcnvKNQ4aCK6vCRQ9nFJJdPaMMbAmgLXrAyQ2jnsYBHJ3zJLNr2NVfhQBNga52hOBI6+lk+TiXs4tomOn2JaDe5JgXTa5tQfvNBQ/U/uW93HAGwKD8CkF3diiZHEas/7sAyzPRnN4ykHI2mS5rLzvsFovGgsChblgS+LA4Py8u/MYqqwYqKKKY+BExfYLFUS3m/ZY4EmgK7LLKxnBSYXpKWjK0SwCbgiwgUgrCyIsuTo7fD/cDgafBkCnimzyIgCrbzVWuIKjxKjLyNEAIL5pZPS3dO5vqla89r+XFpy 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: 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); }