From patchwork Thu Aug 29 16:56:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13783476 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 1114BC87FC8 for ; Thu, 29 Aug 2024 16:58:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9AEC66B00A3; Thu, 29 Aug 2024 12:58:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 95EA46B00A4; Thu, 29 Aug 2024 12:58:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D8CD6B00A5; Thu, 29 Aug 2024 12:58:42 -0400 (EDT) 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 5E40F6B00A3 for ; Thu, 29 Aug 2024 12:58:42 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BE26D1405F8 for ; Thu, 29 Aug 2024 16:58:41 +0000 (UTC) X-FDA: 82505892042.05.0B49F26 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 150A1100002 for ; Thu, 29 Aug 2024 16:58:39 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EUncBdWM; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724950630; 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:dkim-signature; bh=z6SjsdX5+d4w13f2Yod61hus7319jekbv8gEFkX5n/A=; b=QlNshT8IFXKRfqPOBAkdFUiNNWSAT9AdZ/ghfdI5rw3iWmpOUJfWCgVcU30NnTkUuVL3dQ zMoGpeJMA0QuBKPEsAkSxD1V/eosaWHww8h0FrnvUdwMgiCEgnHq1D4sW4jUKE2Mqlb/O5 +EIwgDcQN/bZ+1c/PNrCpLRS7IEnZ0g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724950630; a=rsa-sha256; cv=none; b=oNMD4KeWGzKYNQhMgGx9gn0fY6/GJBX0jJi8OeosohlKbU3KO53TcEfiReRhCEVgi9EDYz jTrWHa/+r4qQcS6PrtQfU7ieFhKeKGIX3ENmRH7pKTq6ERpA+UHJU0DYhbeISwvDMedkNI 07aO5hRQZIYrE5GFfa6bQZ2SDLjkEkc= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EUncBdWM; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724950719; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z6SjsdX5+d4w13f2Yod61hus7319jekbv8gEFkX5n/A=; b=EUncBdWMptcwRqWdMUvgr9KXJhAgnGaXgZVmxoxP56tTRckw70fjpGglNieq5/NlOY3FUP Yw3ZO2rR6eFTi82VnbK2qQsDCtqbK8GjUmJ4iA+olo6QCwkqO39UP7KZ910LCE55bghobB dKp6BmGI+lfw925QFPwcbIqn4VIRfSc= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-608-_x1Mv_w9P1eDEEfjyaDX-g-1; Thu, 29 Aug 2024 12:58:34 -0400 X-MC-Unique: _x1Mv_w9P1eDEEfjyaDX-g-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E0E2419792FA; Thu, 29 Aug 2024 16:58:31 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.193.245]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3B8EB1955F21; Thu, 29 Aug 2024 16:58:23 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, cgroups@vger.kernel.org, x86@kernel.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , "Matthew Wilcox (Oracle)" , Tejun Heo , Zefan Li , Johannes Weiner , =?utf-8?q?Michal_Koutn=C3=BD?= , Jonathan Corbet , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Subject: [PATCH v1 11/17] mm: CONFIG_NO_PAGE_MAPCOUNT to prepare for not maintain per-page mapcounts in large folios Date: Thu, 29 Aug 2024 18:56:14 +0200 Message-ID: <20240829165627.2256514-12-david@redhat.com> In-Reply-To: <20240829165627.2256514-1-david@redhat.com> References: <20240829165627.2256514-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 150A1100002 X-Stat-Signature: 83ezdendfp8wm3xqa9e5j6ugepyxpxnx X-HE-Tag: 1724950719-214427 X-HE-Meta: U2FsdGVkX1/BCM+4UUDzK60QPJ8keConog0XmpzC16E7TMva9n2qQSGGDSGeTQatGPy0tetPNvwuInkA9Mt3XsrNQIOrcma1pQN0KdKIN9oN3BBP43BYryQY62N0BGhJkvmadGnTb0FM5QcIvw8uOr4AKzvba9CgVzLQ39py0if/QU8GnCrxkv0/dVzMd616hWjBcBonhYAHCHnCbCDPYwEpund/G5iIfF8Yu/N57a7A2TdymD1gg4F/z7mc5W4Ivm51dfSygthf7mJG+ERUO39iDUI92akkHJO4d83+/bQDyrX3VGOJkesyc0eTwqZy7ljZ6exJel2ADS+W02z07E6wrG8b9S0LNE+ACXOKmDg6qCf6xAzWaFCnw/rPXWxYDzOfrY/HU2TJnfKNESU++QYB/6eIz0d4y7lSIV3Nsh16xzVHrvL/6S61UP3U3VLgu80H2ciiQe8A7Lxh2sCp4Mf2wXxd+2Yo6kpXEXbaG8ULAcI4+rnUxaaZIuMotEmkJeUNHALtsTG0/JzytgM60+JxUC8tuMIia8LXLem3NkEQ4sb3kSt6h0+99rhEeCnp8bDImGxHNEHTk+UpbQAaecRv8vl11h0ry9VjZXfvdTkeK50znFxV1mPC9WGh+3NB9ThO3e8AVEPMHlWETShydlxCJA6CjfSsC4JuhPmwYJuvVqlPsIalNCaL1XnvCWi4FSagXd7ELcxKWm+ku39MhXnYaEH6dFMT0+Lv9InsG1HM07XNSh+5hIWGpNutxMXXsTrfawchOyiQhUkZGXeSsDUhawfxEz1JaQqKNicYbN/FWjbTfBWHtgU9K95x/+RECNm8a0X2Uj+sZMkmpsbYJ8E/JLZUFNTTwKAuyMCd2dVS86IfryUHYXZLtE6MOsYoMTap7soZCjA9oTy9DwcJBm9VLL/5xb27UmB+LkD5lCkQM+vUMYYKRnI0PrOFotXTsNEWLMLUxhNzT2qwbEU gms6tBiJ ZpY4gxAPeoVMB5V+9b3rLMscQwRFbgKodstGgoRZeclv8n5+BbntU8BiwKQCHchAJFSM9gCrEFlU1A7P7GsPtdscErRGzJOY7zst2zKXrNbj5E9hPhM1WCDAhSevqv7Fp9T+PpJNcrxr+z3rHxm1Rz1WbwDE6rSshyRxi1ciyMdBB3OHtWOL2huyf042W5U3J74tJ4ufGPjDviJ8PRusrFiepDtMUPH91Urkt9b9OzGESFuJSyfie8Km7BTdphC8LYwkrh7z5/aFEas54n6yBBP2q4DPwHGKZ+ZqUWF6YLK/xIZmQjgAvyZ0qELCSSDmuyvjlpm4H8fklZvTLHDycZu0qXQ== 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: We're close to the finishing line: let's introduce a new CONFIG_NO_PAGE_MAPCOUNT config option where we will incrementally remove any dependencies on per-page mapcounts in large folios. Once that's done, we'll stop maintaining the per-page mapcounts with this config option enabled. CONFIG_NO_PAGE_MAPCOUNT will be EXPERIMENTAL for now, as we'll have to learn about some of the real world impact of some of the implications. As writing "!CONFIG_NO_PAGE_MAPCOUNT" is really nasty, let's introduce a helper config option "CONFIG_PAGE_MAPCOUNT" that expresses the negation. Signed-off-by: David Hildenbrand --- mm/Kconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/mm/Kconfig b/mm/Kconfig index 0877be8c50b6c..73cfacbd1cc6a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -878,8 +878,28 @@ config READ_ONLY_THP_FOR_FS support of file THPs will be developed in the next few release cycles. +config NO_PAGE_MAPCOUNT + bool "No per-page mapcount (EXPERIMENTAL)" + depends on TRANSPARENT_HUGEPAGE && MM_ID + help + Do not maintain per-page mapcounts for pages part of larger + allocations, such as transparent huge pages. + + When this config option is enabled, some interfaces that relied on + this information will rely on less-precise per-folio information + instead: for example, using the average per-page mapcount in such + a large allocation instead of the per-page mapcount. + + EXPERIMENTAL because the severity of some of the implications first + have to be understood properly. + endif # TRANSPARENT_HUGEPAGE +# simple helper to make the code a bit easier to read +config PAGE_MAPCOUNT + def_bool y + depends on !NO_PAGE_MAPCOUNT + # # The architecture supports pgtable leaves that is larger than PAGE_SIZE #