From patchwork Sat Jun 12 09:45:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12316943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73AEFC48BCF for ; Sat, 12 Jun 2021 09:46:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CE8A8613D3 for ; Sat, 12 Jun 2021 09:46:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE8A8613D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E9BDF6B006C; Sat, 12 Jun 2021 05:46:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E27D26B006E; Sat, 12 Jun 2021 05:46:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C79F76B0070; Sat, 12 Jun 2021 05:46:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 936256B006C for ; Sat, 12 Jun 2021 05:46:09 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 27CEEB2B2 for ; Sat, 12 Jun 2021 09:46:09 +0000 (UTC) X-FDA: 78244590858.12.2B7A47F Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by imf20.hostedemail.com (Postfix) with ESMTP id F37E837E for ; Sat, 12 Jun 2021 09:45:59 +0000 (UTC) Received: by mail-pg1-f169.google.com with SMTP id w31so1994325pga.6 for ; Sat, 12 Jun 2021 02:46:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gA36+Qu/57nkq0Sk66RXctcjgNPtwynB7KTlt4954g0=; b=He2HYcJkeO+Y2a0BEPzP7w6zmV4ZaW0+JrvY3JJX2HgWx6kChAzLNMY3dPehnfmXmi wuK9Hs2J7MAu2n4MQEOOi9t4EO00T+l67LHxPjSpkLuvgpvnhB9H0k/ybFYXr2/ZuhJ0 83nIrjv2Unnb920e0w9MkaK+FawhFDCgK8T5mTbfuIB1v6dpatuqaAMH7+dsMq/oomet 8LaeK0tLyBRvM20bDRtg2h+Ks4QdsvpoCrHBG5uWJJxzjdAWf02bTvgXcaJdSTmHHymi OwoIwtAylFcX2ENm/UY07Op+QISCsf/y2k/FvKNQKWuNL7YU5lY/K+5bqIRGx6fxWdJN 89bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gA36+Qu/57nkq0Sk66RXctcjgNPtwynB7KTlt4954g0=; b=dbuiM7s/SNtnr39K7wQQMpzVYScXqEitnbyjKU5GEnvrH5F+N/Pd/amFg5RuXQXj2s dJO+3jtHI72vdivSbEfFc8u3i7/RJDqT17vBRsl97anb7HOv/Igxa/MlNR48i0062LGT zAEjYOMmwrohXtw2jnO2FCICUETUpUdZofHvTZF/jygKRTwenKjIYZ5Eg5KlzBaNxblC hiir/0n5/LtZklON78bYUy7VkvEpIengo4OWbgmkFS504hM15QtpzYfwTOUL/tdsGYdF alrV1v3MrZ/+N6l+y2pU6KwT4VT7dDtCdFO7hBhIXE/0icI6m4F1eSscx+hb00eVj5xO Ycqg== X-Gm-Message-State: AOAM531g4KxdCefVTzlouDulgWLjzGGcKNC8n+rRy35F30aWX1s2skE8 3baOm6JqEdAeX+7s3TVgT9e5lw== X-Google-Smtp-Source: ABdhPJzjvMIBpki2+QrmEYfAaapi7sVu+lRKjPmHd6xRamGe7Rxsj/7f5BJl9/x5reeW6ODPXTSFbQ== X-Received: by 2002:a63:d08:: with SMTP id c8mr7964471pgl.248.1623491167246; Sat, 12 Jun 2021 02:46:07 -0700 (PDT) Received: from localhost.tiktokd.org ([139.177.225.246]) by smtp.gmail.com with ESMTPSA id t39sm6929557pfg.147.2021.06.12.02.46.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jun 2021 02:46:06 -0700 (PDT) From: Muchun Song To: mike.kravetz@oracle.com, akpm@linux-foundation.org, osalvador@suse.de, mhocko@suse.com, song.bao.hua@hisilicon.com, david@redhat.com, chenhuang5@huawei.com, bodeddub@amazon.com, corbet@lwn.net Cc: duanxiongchun@bytedance.com, fam.zheng@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Muchun Song Subject: [PATCH v2 0/3] Split huge PMD mapping of vmemmap pages Date: Sat, 12 Jun 2021 17:45:52 +0800 Message-Id: <20210612094555.71344-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=He2HYcJk; spf=pass (imf20.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.169 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Stat-Signature: sr6wtxa1kp68qppz6exz8qi3dyxz4jkt X-Rspamd-Queue-Id: F37E837E X-Rspamd-Server: rspam06 X-HE-Tag: 1623491159-521977 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 order to reduce the difficulty of code review in series[1]. We disable huge PMD mapping of vmemmap pages when that feature is enabled. In this series, we do not disable huge PMD mapping of vmemmap pages anymore. We will split huge PMD mapping when needed. When HugeTLB pages are freed from the pool we do not attempt coalasce and move back to a PMD mapping because it is much more complex. [1] https://lore.kernel.org/linux-doc/20210510030027.56044-1-songmuchun@bytedance.com/ Changelog in v2: 1. Collect Review-by from Mike. 2. Remove helpers used to preallocate/free page tables for HugeTLB pages. Thanks Mike's suggestions. It really eliminate a lot of code. Muchun Song (3): mm: sparsemem: split the huge PMD mapping of vmemmap pages mm: sparsemem: use huge PMD mapping for vmemmap pages mm: hugetlb: introduce CONFIG_HUGETLB_PAGE_FREE_VMEMMAP_DEFAULT_ON Documentation/admin-guide/kernel-parameters.txt | 10 +- arch/x86/mm/init_64.c | 8 +- fs/Kconfig | 10 ++ include/linux/hugetlb.h | 25 +--- include/linux/mm.h | 4 +- mm/hugetlb_vmemmap.c | 11 +- mm/memory_hotplug.c | 2 +- mm/sparse-vmemmap.c | 157 ++++++++++++++++++------ 8 files changed, 149 insertions(+), 78 deletions(-)