From patchwork Sat Feb 18 00:27:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 13145372 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 D330EC636D6 for ; Sat, 18 Feb 2023 00:28:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 212626B007B; Fri, 17 Feb 2023 19:28:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C124280002; Fri, 17 Feb 2023 19:28:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 012556B007E; Fri, 17 Feb 2023 19:28:51 -0500 (EST) 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 E86E86B007B for ; Fri, 17 Feb 2023 19:28:51 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id C9070C07CF for ; Sat, 18 Feb 2023 00:28:51 +0000 (UTC) X-FDA: 80478527262.16.DE0C763 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf16.hostedemail.com (Postfix) with ESMTP id 1FC6C180007 for ; Sat, 18 Feb 2023 00:28:49 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ghgOaEON; spf=pass (imf16.hostedemail.com: domain of 3wRvwYwoKCN4JTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3wRvwYwoKCN4JTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676680130; a=rsa-sha256; cv=none; b=hhv8GadV1wRl2KPEAGFjlCGotBkt0C0Dz6pJxlat8pOLhNE9PM0w+jm+LPGm8apZIOpW4T 8H0wVfYvOdL+Z9Hm2Zkcg35B3RE19gBmKnyGFZADhGAcUhSRiywJKQxZ0RGVGw0gV1fOT2 jbNwqmUqiBp8rPbYWB8mYNjLFWmV/GQ= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ghgOaEON; spf=pass (imf16.hostedemail.com: domain of 3wRvwYwoKCN4JTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3wRvwYwoKCN4JTHOUGHTONGOOGLE.COMLINUX-MMKVACK.ORG@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676680130; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8nfyEWndKsa3tyc1KlPsVZDyN8xlZ4zW0vpf47Ary0I=; b=uA25vtHs2ZGF/bjxGfOtRCBSz0p/Ic8L5UcIIbHZqJ6E3AklpE2RSBCT3KHaiRYRnoeDpm DhfTQqPmAODZlIpZh3JQPJdXkf688TwS4QO1NMEASIi+attS0C9+HUcJPLyqlHtgMayFR9 vxYBKM64UN6kXqp7kuKhgrqpLBJcHEo= Received: by mail-yb1-f202.google.com with SMTP id q8-20020a25f408000000b00944353b6a81so2505258ybd.7 for ; Fri, 17 Feb 2023 16:28:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8nfyEWndKsa3tyc1KlPsVZDyN8xlZ4zW0vpf47Ary0I=; b=ghgOaEONmk3TxY7Vbd4llR8C6ZhiH535rAEn2mRoH4sgelGi+DzvBNDNzGInJZzqfs MEErbyZH29/h7FEPNCh9VZcW/Bm4YgRch9ir0kS2NDXVsbFg5l6v2m5+GdPoQ68p73Au kx7/25Br5F6Yw90cWFqLg3eViGqsOMcWI58kCeCLrtLPN7KaOw1BIGgyIswJlZykM+9O 0y4w9vz06OJ9NLQ+jIbxIwJsCdh/V36xONqd3gjqH80qszv271zhh3nf8DhiYiNLA2qQ k8oLBo0ZQMuPQXPM4GYcllmYMP6s7dZX1ehwhZA1pOfZpnWcQPV0VVxxICdxJelUUbzk U9lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8nfyEWndKsa3tyc1KlPsVZDyN8xlZ4zW0vpf47Ary0I=; b=ndPJHfwO29s3GjpXj2XIZe7/ays0VuY8oQ6QiRTYcWfFOOOeD7RqpGuYaasEnSRnNf Iwlxs+fI8e2hyNjrgykEE0yKhqFqxGEnGhvYpZmiohpoJzRGIHrUyQUxzd5KrXAMGTER qxYHqAOlBtqfAeaD+QyZ3OC0G5URRrBOiWdUqSjBm147T+gTsyQJccinwZw6fcDusa0Q ZYwMUa7AfyrzCdyn5Q/YCn4Kna8T5XdkjRK9Ta2lnb2FosbLsouOHr573vzGuSGJ2zjt 931+OYPzhMBB+JqP4HUQRxp15Y59CUgbP1w7hfXbEBvICrN7fxiJRfzVEw4IrzEbQHFq bkgA== X-Gm-Message-State: AO0yUKXRNmRmHKyVDToZBOfaGGgP9fChuvESAE2Jo6+EOyqCt+ZahYJ5 +WIDkEM/RlDh55ZCnfFoGgyS+aj5FXBDwY6w X-Google-Smtp-Source: AK7set+i/pEV+wA/Uyq68EOFTB/N9gXVBIKZiQfbLrFGkhuKCKH/yF+5J8fuZrkmB0Jrum8skN72smbY4sjy/+UA X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a05:6902:241:b0:8db:41c9:aa6f with SMTP id k1-20020a056902024100b008db41c9aa6fmr200113ybs.2.1676680129319; Fri, 17 Feb 2023 16:28:49 -0800 (PST) Date: Sat, 18 Feb 2023 00:27:39 +0000 In-Reply-To: <20230218002819.1486479-1-jthoughton@google.com> Mime-Version: 1.0 References: <20230218002819.1486479-1-jthoughton@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Message-ID: <20230218002819.1486479-7-jthoughton@google.com> Subject: [PATCH v2 06/46] hugetlb: add CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu , Andrew Morton Cc: David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Frank van der Linden , Jiaqi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton X-Rspam-User: X-Rspamd-Queue-Id: 1FC6C180007 X-Rspamd-Server: rspam01 X-Stat-Signature: s6qmpfexmi3ukcuz7ft1fd8t44eosnpy X-HE-Tag: 1676680129-325041 X-HE-Meta: U2FsdGVkX1+K/ljF7Y8u3yPfz6pM9RVLe5vR4nhFv4K0fFvgEGVKOP95mTlqM9qS1V3cJV+LEHpLaZaesg1zP7eeGDfSjSgxXlGdKC5X4Ax+ef+Zlt5u8I6i5VwXYHsVjKdo7MBH40sk+Fr3CR69ZnV9in/HCDhfyKm2DiOzdRqMst8JCVBpVEXhkvTdFIJGR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L0Aj+F5cxg92LdF9Ll2fGDjHIkMocu1oqMfzqpx+JI3aPZ6Hq8fQQOk9CRgUKn0vTEW8wb6UIAH1YIop/bZ8JqDPyz3tON25sW5B+keBgv3g4Eo5YeiGlgpgX3MjPIdtaZYuoX5Am1zLD5j9oN+pYXSTG1nPhyt43m6DIBbNbqB7+gRwCay4O1y7gRsvAVoAASzgyRSK7NMUQ7ntRQz4nXav8LH+vXiWUdpbYh7XZoSW3eMLhDFxfZkPEOsANieI9r/mIhXPIz4+bS9rN9v/tohF7gFPYjktl5Zznz1U6nh9MmPXSZNC3i6VvjMKbzmyOBFq7DRz1t7QEqoq1/JKxo= 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: This adds the Kconfig to enable or disable high-granularity mapping. Each architecture must explicitly opt-in to it (via ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING), but when opted in, HGM will be enabled by default if HUGETLB_PAGE is enabled. Signed-off-by: James Houghton diff --git a/fs/Kconfig b/fs/Kconfig index 2685a4d0d353..a072bbe3439a 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -246,6 +246,18 @@ config HUGETLBFS config HUGETLB_PAGE def_bool HUGETLBFS +config ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING + bool + +config HUGETLB_HIGH_GRANULARITY_MAPPING + bool "HugeTLB high-granularity mapping support" + default n + depends on ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING + help + HugeTLB high-granularity mapping (HGM) allows userspace to issue + UFFDIO_CONTINUE on HugeTLB mappings in PAGE_SIZE chunks. + HGM is incompatible with the HugeTLB Vmemmap Optimization (HVO). + # # Select this config option from the architecture Kconfig, if it is preferred # to enable the feature of HugeTLB Vmemmap Optimization (HVO). @@ -257,6 +269,7 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP def_bool HUGETLB_PAGE depends on ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP depends on SPARSEMEM_VMEMMAP + depends on !HUGETLB_HIGH_GRANULARITY_MAPPING config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON bool "HugeTLB Vmemmap Optimization (HVO) defaults to on"