From patchwork Wed Jul 19 13:54:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13319020 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 058EDC001B0 for ; Wed, 19 Jul 2023 13:55:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67A7628005E; Wed, 19 Jul 2023 09:55:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62A1528004C; Wed, 19 Jul 2023 09:55:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F16E28005E; Wed, 19 Jul 2023 09:55:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 40F4B28004C for ; Wed, 19 Jul 2023 09:55:09 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E2DA114036A for ; Wed, 19 Jul 2023 13:55:08 +0000 (UTC) X-FDA: 81028507896.08.41140D1 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf08.hostedemail.com (Postfix) with ESMTP id 0FF6B160006 for ; Wed, 19 Jul 2023 13:55:06 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.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=1689774907; 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=jOsmJTUMe80oyoVc9BtLwsaKcMuIOW0WG7B6ytpYj5AZE5cIyjMhUzoLLAcBdPMB0ehVgq c7/qPLHN3ddo7wqy8UsT7fhxXtQ271ZmQsEpdLem+eWx6h2OROIHyYFAPsdO4eAOI04rVh 5j1zoj9TJBhsOgvMXfWnOn1lCxiLKRk= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf08.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=1689774907; a=rsa-sha256; cv=none; b=JT+B5FiRtO/q3GPO9kIDqsOIQXFFXJFC7pzQGzFlv5+jn06g0Qa4fkQgY9oc1pTlI7urmz ScIKVfwN9a5BFfmFKY7IlZZUaKOvkadD1SiNRvDzOCELJ6fFvMKePsNHRL5bbUj2hdMaJH DxuZLgF8ZWPohIKxZxruRQjm2qAh66A= 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 6CEF3D75; Wed, 19 Jul 2023 06:55:49 -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 90B6C3F6C4; Wed, 19 Jul 2023 06:55:04 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Matthew Wilcox , Yin Fengwei , David Hildenbrand , Yu Zhao , Yang Shi , "Huang, Ying" , Zi Yan Cc: Ryan Roberts , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v2 1/3] mm: Allow deferred splitting of arbitrary large anon folios Date: Wed, 19 Jul 2023 14:54:48 +0100 Message-Id: <20230719135450.545227-2-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719135450.545227-1-ryan.roberts@arm.com> References: <20230719135450.545227-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0FF6B160006 X-Stat-Signature: zpmpbk6wee5qnrtneg7a6dx37w9e5r5d X-HE-Tag: 1689774906-629940 X-HE-Meta: U2FsdGVkX1+KvyXthtpl0YOgavQtIgvqETH4pQmPbjUc9EQTOOSe2HVfxtZlYO6DKm7btJx+0RmtqErvjyoSmAfW3/waRgiE9tASfl4o3d0eleKrZpEqK3Pyy7bvurpCnpriDKcCYOiiFw/FsCuzMDuWd1rWgJpYwUZ7taGo0XhDC49MONqMPiaAHjK0vb+rE7ekfbR7xGZdU4np0bJNrXsxXUjsvKxrp+5hJ4ykdSR2CXcB+ffSoRZJv/vsFOW3okT1Z/o7Ka2kmg8Q1pWN0o2qK68Y+7zJ20hYZAPiCmkmRnudzQmyynGYk+8Kgj3xgYSMoTI4bYgBp5RLMljy9Oynw82wMA7Ulj0vlLXpByncozcZOwmbhiwRfdy948OD4VRJTlOxFtQZyI32BMyYf+ADLdQDQG43oscxdATOewjwhE5hq1kx/F8niPM+PmYBP027buQ31134Wui4HvVUx0soKpG1kzbFOGbfYi6nT67eY6tnAjORYQ43cyhYNFcci3Pt0HJ1E79ZKGVKWqZ2yKOMwFyuWBV+tCfioknw+lMRzbdL6Z/5iw8mX5RYS5aIjPU4EUA1de285bOvBOqy6A8aTaTA93DMKP6BEm3FEKb2s3NgdCSEbxHhiwtEmSZafRlZsy8/pukVNYl4qxTDWdg0CRkDqYTT/XbtQIlLNd8t90pUHQJEwYjVEt1QAFERwzpekud51vNYQGlmjAa55FMdohuBvH7YD/G3yBAUs6Z3dhfjCu4OfNgwqXNGA9ggcVUYk/D3VKYSdY5CzKhmY0YrguGpWI/lnpOA3WTTFmqCRINVeiySjdBUK/H7CbeiF40jJbInUG38myhQM+JpbW1eMJXnPVxVxWef59VyApiRbt1pV6xZBvxpImsWLP3652UfCQ+YsEN00lA3avYnrLXOnqzJli5JmxkpGgjpNyY0WMHEdo+Nxyt7I2SA8ZNdt2V3btv+cJnBTDZ5hK6 lMfH+pq2 LOX6jMiKTWyF+iriH2p780H3nLleO58jYSnzuNg86BI85WsuzyHwsPHDKa4bjF6pY4JwrYKoCdOPeBMLTzPT5olcyQK3dw3vWWEuFDsIk+BwpBgexBpnsmei5x0AO+X5CRcJXlnDdHKN6FihtaW9IMTeh+Q8bWTCMgKzECKfo0NSgAL29kWC6xnMM9eudCDJD9xHlZ7+ue+uf3cZu2oQFDgg2mvuYBWK/w90zMSMJWC7/biPWt1aWQu5MF9TC/Zpd0eYDWW8n4ramLOWc1z+xQrxU5rqwvE2Ho+o9 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); }