From patchwork Thu Jan 5 10:18:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 39430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp227356wrt; Thu, 5 Jan 2023 02:21:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXsJ/8zKF0OO9y25zl8os9B/EMZl/57tKmVra434AOBuFP3XIquEP304cpMFE4XZCpDo7s9d X-Received: by 2002:a17:90a:b288:b0:225:c2b4:5742 with SMTP id c8-20020a17090ab28800b00225c2b45742mr45680038pjr.34.1672914096054; Thu, 05 Jan 2023 02:21:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672914096; cv=none; d=google.com; s=arc-20160816; b=sT9MpP1k4S6O8+vor3Q05YEJi7u03KBuAF24naE6tx//KvwqRDU3VLfWb2MtiEppGW 3eJbJ8+N3STgCyEsK2x6SzLJvdK3tZPwHBlIQX0ofZqQjS7nzc/0ji04FlTkvHG4WAKr NAQvbiU7sNl//soBw7Wnw9qiT2Z8RFA73dzkOJ9UWHU7Mkb2NO030wYh1e7YkfRXwayL N91S/SfHhKJc4fnw6FQtbFYQBEGnAufQ6nLQ91bfv/j3q0/iTPQe3P6wIalx0FbnTQPv i2qnTmj7yj/JdyOLoP0GpOr2a7QidIVX3l+SH3c8rI1RRcG4PhJR/LUkvVADqQbnTZu2 PwkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=QisuvGCTCnQrC46aY73QASoWAbEZFo7ff5Vj8AOV5D4=; b=Lzuhog84PkQAtEdb0I7iVk8b+5s4Q0EH3FTuq9ito/pUZFodSm1DsAbKF0ZR7Ef1Nk k+zh+IkFsMoTVpArHBv6U13RcWMfETpZ0aM0Au4+o7UbOsW5A6faiB3EfN312Mz7OUya /9JD0udlufX0PuTWqIKgEChPjfz+41w0Hc3KlIrIRAthkt2TRMxSfGkTDMong2LbEfHq qeCygZwPW5Z9M0o15JQs+rjrgWxrOTcHYKPxGMfPDeF7IeMIgiDAyG6P1DdXn3yNfGAD A1UVZ6yck4M7MNMhJiBnjPlZdIQD45PfTXG4KJJroPtUsIurub2rGzqua49js0OZepFM G80Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=D05RGKnu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020a17090ace9500b002213d9c01cdsi1452214pju.136.2023.01.05.02.21.23; Thu, 05 Jan 2023 02:21:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=D05RGKnu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232707AbjAEKTq (ORCPT + 99 others); Thu, 5 Jan 2023 05:19:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232598AbjAEKTN (ORCPT ); Thu, 5 Jan 2023 05:19:13 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8234A50156 for ; Thu, 5 Jan 2023 02:19:00 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id a4-20020a5b0004000000b006fdc6aaec4fso36882267ybp.20 for ; Thu, 05 Jan 2023 02:19:00 -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=QisuvGCTCnQrC46aY73QASoWAbEZFo7ff5Vj8AOV5D4=; b=D05RGKnu5npzQ4+IoIOCUoopJdHBZlGdmzR7wKgjiYJ7fpsPJXuc7/AVMHrkDHqo2o RNix7ExBJuxdhCqhn48A5PCySgryuQc3GCHIVd9cC5LTv0Q9aGo5YYJG8Ce+XT9OpeXk M3IL0FBVE2YUx+rEwav3paVke2g6M0EhpZNkkEWcM4bLj0uxgg8utb4DdIrHzftCy4tA Kij4pO4w0SwaaYqXSHOVWmgJ+wQsZ23Y9Y/ujE19y5mdHZG78XAtWGKWdrNVRkm9Nl44 elMxTtHTuRQV91u0RG0dTfAvGUJKSIuBA+Spih8dBWhAl2BkcB0t7zcxNmwHvfL9sk81 3ptA== 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=QisuvGCTCnQrC46aY73QASoWAbEZFo7ff5Vj8AOV5D4=; b=bI+UbhFoZYNZW+Fsd1qnpMj342fV5eDzP/Z5NXBwfIF6ZQtDmnJsukLUDfydugn0aA 4K4XEhs0LXWcdVYqQH0ZX5VBhH2QPY9oLjUxdzGgtfxwJtKjVd/feTrMayvGAbqSlQuP pqJ4cO6zl0PHCLAX4hxGwPhQssmoAY+KAsweVxF3h80N20L49IZIV657JfZT0/pzSXfT sBJwSTmNS07Pz4HlxT9P9eAGdz8EHSAcuxI6K0XwI0fWFGefRbPvW6NKhLjDfmd13Pwp dBQ7+uwPXPZUlNPnurp7sUKFHn6lvaSl0mQArMF9UOnEKicvRRPLGvQzYQEu2WB/2g8j MBGA== X-Gm-Message-State: AFqh2kp4ho5J2pAWpkNV04/1FYjW3H7EokoUeZc9H8kGX9AL1po6uCMr yCpU0li2doWLLQyQNm4a6ZAkCrDmQjyPczaY X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a25:ab4a:0:b0:7b4:df57:d887 with SMTP id u68-20020a25ab4a000000b007b4df57d887mr131335ybi.601.1672913939807; Thu, 05 Jan 2023 02:18:59 -0800 (PST) Date: Thu, 5 Jan 2023 10:18:03 +0000 In-Reply-To: <20230105101844.1893104-1-jthoughton@google.com> Mime-Version: 1.0 References: <20230105101844.1893104-1-jthoughton@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230105101844.1893104-6-jthoughton@google.com> Subject: [PATCH 05/46] hugetlb: add CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu 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 , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754177571040605921?= X-GMAIL-MSGID: =?utf-8?q?1754177571040605921?= 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 --- fs/Kconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/Kconfig b/fs/Kconfig index 2685a4d0d353..ce2567946016 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -267,6 +267,13 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON enable HVO by default. It can be disabled via hugetlb_free_vmemmap=off (boot command line) or hugetlb_optimize_vmemmap (sysctl). +config ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING + bool + +config HUGETLB_HIGH_GRANULARITY_MAPPING + def_bool HUGETLB_PAGE + depends on ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING + config MEMFD_CREATE def_bool TMPFS || HUGETLBFS