From patchwork Wed Jun 16 09:49:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12324689 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 4D884C48BE6 for ; Wed, 16 Jun 2021 09:52:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AB61E610CA for ; Wed, 16 Jun 2021 09:52:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB61E610CA 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 176996B006C; Wed, 16 Jun 2021 05:52:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14DE16B006E; Wed, 16 Jun 2021 05:52:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F30256B0070; Wed, 16 Jun 2021 05:52:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0004.hostedemail.com [216.40.44.4]) by kanga.kvack.org (Postfix) with ESMTP id C10CD6B006C for ; Wed, 16 Jun 2021 05:52:21 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5D23310F0C for ; Wed, 16 Jun 2021 09:52:21 +0000 (UTC) X-FDA: 78259121682.21.DD413AE Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf19.hostedemail.com (Postfix) with ESMTP id 397C09001460 for ; Wed, 16 Jun 2021 09:52:08 +0000 (UTC) Received: by mail-pf1-f174.google.com with SMTP id z26so1771152pfj.5 for ; Wed, 16 Jun 2021 02:52:20 -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=faEsJMYXdkq8dqS3OMq39MuM6MrUVUE48pwQCvuwLyo=; b=E/heCUjIPKrneHxRTcWIoANtbWzp9/NKkzSQIn4UXCT1LGzmovWGOGnDwNBjSGzZOr ZVreRiQN5i33TqoiLG11vQ6QKWz6xsMgrqklp/GNXMJ076RJe3cto4h+HifqlTejLrXd DnG5ZxonZLWkQDEkjJHnciuZOPAt2PvCoEpsjPe77X9UBSNr34ajhMWXnr4AVL6bV/kh iVqk1zgxYlMeATTuLOq7Zv+fE12rfXV4HdCitdkuPorD1FQgLs66KdowpwphyUn65x3O GN80sNJdZDxNZX79VCk7A6YUDUAMzgIQRQ53P1l6jh9vOLgrzV+1mYo2G3Xc++CjUgY9 lkqQ== 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=faEsJMYXdkq8dqS3OMq39MuM6MrUVUE48pwQCvuwLyo=; b=I5bNOBLipjYO5akXoNztrm5vDqnjfxgL8NL+YHUX1hbQGQgakFSd1u9DtJ5CesWSdA t6YUcGXBgCrpkdF4KRnIHZRQhDoooVcNrOaa846A3k99JF2/IGsj/F1USbqrd0ftoMvz St5viE2WObTu6i2nV4a5efQT0FslcdBzAz6WvsNJhWA2kdGDYlpZTSHETbVy49WBuxNC HGM+zl1vwIP8L8ACZcgLdqzoWCKt0NnFB1Qg+0lau8gdFJErxZ5m4Y4Lkg/f94u6LbfT yiVeMt7CyDqfUhamamhyX1yeTvkCPOo5OazqSgTOupLr98fKzg2um/3T3HyGj433C4Mg icxQ== X-Gm-Message-State: AOAM5330FZs2U1isVskpnX8BFNhUBp7uJkEmN2tf1grBUSW6+wP2qwOs wak0KzjARd7a8eZqFQJByxhX2g== X-Google-Smtp-Source: ABdhPJyLoWkINbZXH8GwrdSel4LYnkl8T6vc80euLaz6NBhLNeIgG8RVBXnpwl56pjjq2IzLJecTdw== X-Received: by 2002:a63:d47:: with SMTP id 7mr4101239pgn.339.1623837139177; Wed, 16 Jun 2021 02:52:19 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.246]) by smtp.gmail.com with ESMTPSA id a20sm1744222pfk.145.2021.06.16.02.52.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jun 2021 02:52:18 -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 v3 0/3] Split huge PMD mapping of vmemmap pages Date: Wed, 16 Jun 2021 17:49:12 +0800 Message-Id: <20210616094915.34432-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) MIME-Version: 1.0 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b="E/heCUjI"; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf19.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam02 X-Stat-Signature: j31363tmcc1h6ej3jyttaj75iwdm836w X-Rspamd-Queue-Id: 397C09001460 X-HE-Tag: 1623837128-648279 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 v3: 1. Collect Review-by from Mike. 2. Rename 'walked_pte' to 'nr_walked'. 3. Update commit log in patch 1. 4. Add a comment above vmemmap_remap_range() called from vmemmap_remap_free(). Thanks Mike's suggestions and review. 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 | 163 ++++++++++++++++++------ 8 files changed, 155 insertions(+), 78 deletions(-)