From patchwork Thu Jul 27 14:18:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13330160 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 9B274C001E0 for ; Thu, 27 Jul 2023 14:18:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 417756B0075; Thu, 27 Jul 2023 10:18:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C6846B0078; Thu, 27 Jul 2023 10:18:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2673F6B007B; Thu, 27 Jul 2023 10:18:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 187DB6B0075 for ; Thu, 27 Jul 2023 10:18:57 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C0D4FB13D8 for ; Thu, 27 Jul 2023 14:18:56 +0000 (UTC) X-FDA: 81057598272.18.88C97BD Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf26.hostedemail.com (Postfix) with ESMTP id A05D0140015 for ; Thu, 27 Jul 2023 14:18:52 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; spf=pass (imf26.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=1690467532; 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=hNL1y3SfunmfxSUTvIEH48/V1tE9GSr47MXZQeskAHk=; b=capOYwEB2oIMsD8BpcCk2JMPnmw1nZ62vS8bi+/zfvos059GD2NqRlM/yI5T5TmwyIy1dn slOu1HCQmTArIDglgnxmCHuL3OimjUcpaRPJoe4IseIQ4LKcapJmhiipAvThQFwLpXGRXI Rhw3lEsy6d8rJTj+aFBZmqxt9l/lIes= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690467532; a=rsa-sha256; cv=none; b=Cx3mY/rkvPla+IJsbFJoyjP3yfrk03MSfA2Bdz1N8H9UW1XLXqfpF/X+nxR+S6NumDRKld QO9V7JYN19jlYcvxPDUzKuNIZnwjpzfhuiVnHLwxFXHTCglKNHRAP/ITGfiXTGkCl3nrfo hlcH/sO4/085GG76euHmCfmvqT48XKg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; spf=pass (imf26.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 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 92B98FEC; Thu, 27 Jul 2023 07:19:34 -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 8D9823F6C4; Thu, 27 Jul 2023 07:18:49 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Yang Shi , "Huang, Ying" , Zi Yan , Nathan Chancellor , Alexander Gordeev , Gerald Schaefer Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 1/3] mm: Allow deferred splitting of arbitrary large anon folios Date: Thu, 27 Jul 2023 15:18:35 +0100 Message-Id: <20230727141837.3386072-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230727141837.3386072-1-ryan.roberts@arm.com> References: <20230727141837.3386072-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Stat-Signature: kdys8dgcxk388uwf1pc165w1ubu6nq3z X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A05D0140015 X-Rspam-User: X-HE-Tag: 1690467532-119398 X-HE-Meta: U2FsdGVkX18IsIJcWQ3u0/aBjl/dRQSaS9vCJ64KTJG2kkaorGaKrlgcuh+mg6aRFVZqhkrDZPFCmljdrjXullK93RMx0IAmm4cCI05wBRNDvt414o3Hcn2Wy8khveqOEWosYc/8OYfvCyWDjjXfP9wjzeHHB4vp0LcQAWbsCBmbuBJBV4ssITuQ1jTOCkgO9KVSmAc1XP7uORQr+tAo6Bxwb5EGXfYIXWrQQ1eB8ron+0QFdzUMn10tud6STq6ya1t54pVXaXPpGLBhjb0J2LkMo7gc/FncL7jQvuUf74RQNHic+uNfO1NMXiGQyzkrNa3FPOgly3DSTHVk0RyZzAZcQJLacmO1GpXcd4xEH4e/o0HxmX7Iyd+rBYwlBHBfzrPp9+/sKSMMOm69J2irlWOUJ1lMNwMIrLxBY7UF97yiziJmXFiUnldnCWcuLehJq/G3u2GboXVp737Wa8vcjgF6CcX2BMCvHwbUKyeOlmO57oAikd7082yd/PmO9cGHPTQv/vSHk2Ti3WmL+UzvtM32iL5XAHOKePUjKZZrG1YxqpWHpK5MSJA5oB7GUBDagqw3ZEhVgv1EjfOzhFNcX7vxUmZRkCgP/vULt7mydxifJuL6Flnt0kPGZ8R7mevtpg06cmLaOW8cef54OeO3a9+6oh7i+bwLKaPZVFfaYjjaGT0qAKFD+6XfgqHVHJEiX0gMTIJwOzpOP2sqfL7AFikIH1EIpOSqVwfMfkUYpWbxNgCbek5uV/sr2ayrTXBS4Aoh2U/tqtiTTe6v2SqhPhpvjT9Da10Uh+qWGhgN63SCQtPN0aOOlKWNnlYBJFQzH7Mgnb7ixGnmRbYAiNimc9Ohhvy3RjZ1uxdknmyluwgiSUg4oFPrGNsKffF7874Gr/wAFhpayNWES4zGuhMShli736o4GLjyYq4zfG+BQQUtW93f/p+V414Fm+/GOYX0ICg8QC8fmFteyZF6JkA RmJN93LZ WjOHQQsJSd7segqm2EGiWBVW+yhVc/s3E3EJq+7VsImdEdcUpE02CdzSZQoU2+f67AfhdnZYTapIR8FFBQ8o+9Plt38L0Wj4TGSjM5TrqEE+vIyXMgViUT13SZzktUtdF2gJaMLJZFh88JDBSMHY1o1UQ9MxPP0MBCk3ejkqgATDTE3hp4SJh0DZtpJ4/b2hiRpl+hXIVAgDrtvSjxoJwSYIxLmgrgwkQZDYQew065jRGCrWMlX46EoJna+ZHjXltxKe1XqUq2zxYmieKNrIceTfGVu4yku21tAPy 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 0c0d8857dfce..eb0bb00dae34 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1426,11 +1426,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); }