From patchwork Mon Oct 18 10:20:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12565969 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C529C433FE for ; Mon, 18 Oct 2021 10:25:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 121AF60FF2 for ; Mon, 18 Oct 2021 10:25:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 121AF60FF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id AA92E900005; Mon, 18 Oct 2021 06:25:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A58A5900003; Mon, 18 Oct 2021 06:25:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92106900005; Mon, 18 Oct 2021 06:25:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id 84A2C900003 for ; Mon, 18 Oct 2021 06:25:56 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3F6458249980 for ; Mon, 18 Oct 2021 10:25:56 +0000 (UTC) X-FDA: 78709177512.01.8A906A2 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf18.hostedemail.com (Postfix) with ESMTP id 6C59F400208E for ; Mon, 18 Oct 2021 10:25:53 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id qe4-20020a17090b4f8400b0019f663cfcd1so14146330pjb.1 for ; Mon, 18 Oct 2021 03:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2UoWjZzOHViEmzMC0Qv5p6Aol3nKS7az97fC7P92qe4=; b=Gd5h2gBCnRqEtZChFB1olUuihrmox4cKyIUyPvGqjLMLY6jUZ3uNVPFTHJpBzZo6qf 5Hl+3LYSiOcMkFuJpfr5+FRq/6ej3achjCnGkj1gjgWjsrPpaglpOzUccBvGHbXhyaRJ U3bqhb81C6A//0N06JgcY1sw7snoGzjn3zeZaH/myJFRSRFGM91aXvZqjOVwPG3AKLCg l92aTjdVAWMtEzATNw6Dq1y+py7fkGmsKDAM3Z1yAreL6h1LPiSSfEJ8xS/viJRZD3xZ hZM5KDPXAdAWFQK0ron8FDsAZCo02VaPhkeRYGlsOXRWMa+c05HGLFF0lVGshnjQkaOo ZLqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2UoWjZzOHViEmzMC0Qv5p6Aol3nKS7az97fC7P92qe4=; b=Cb8Pv3J0ubiHVz3pn01QrfP0hdzlIyvr4Pc5YfwTNGZyuF2TnILbR8zo9VldlnUuIK BFRAh7aZUTh2HZgH53ly2rSIKX6asvJVbynoXhOQbc1f1pNvUKOQiq6w0HByPzHlb+Om SajS6V1uRqqCTZq0pwsLosIl9IFnGqpv7dI5wZIPUhzqrcSp8IA+O0MNe+Dl55Ihe7gD HrA14Fj/vgDQDaFEM7lNw7kiViIMJbc2tibJ6S1ojS2XEv/9rMxUzzYEsIOXZmLDJwpS 96bKYMp00DZZNMZxR+jZmGsXgjDKTXiijKnJyFp0c2uQabmj/iGg11oFwjAv+BXOSJad fvwQ== X-Gm-Message-State: AOAM530Cn/NF9V/8ig/4QVAsjPRXsCLgOWuK9U4AOAyxIVikwuNym7Sd 58tQ7pOieY+vsNlUQpbS9Ms+Gw== X-Google-Smtp-Source: ABdhPJwYZ3gvRiwyFh8hGZtiS4aEnAV/VG+UgzKIi92f3MeJyhYUk6ojpZOUzHRjbfYDUeAIK1iKTw== X-Received: by 2002:a17:90a:1a4c:: with SMTP id 12mr47381855pjl.89.1634552754998; Mon, 18 Oct 2021 03:25:54 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.237]) by smtp.gmail.com with ESMTPSA id nn14sm12762232pjb.27.2021.10.18.03.25.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Oct 2021 03:25:54 -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, willy@infradead.org, 21cnbao@gmail.com Cc: duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com, zhengqi.arch@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Muchun Song Subject: [PATCH v6 5/5] mm: sparsemem: move vmemmap related to HugeTLB to CONFIG_HUGETLB_PAGE_FREE_VMEMMAP Date: Mon, 18 Oct 2021 18:20:43 +0800 Message-Id: <20211018102043.78685-6-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20211018102043.78685-1-songmuchun@bytedance.com> References: <20211018102043.78685-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6C59F400208E X-Stat-Signature: 9cuinznroutricyq4h19b47z8hf99qym Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=Gd5h2gBC; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf18.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-Rspamd-Server: rspam02 X-HE-Tag: 1634552753-520510 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: The vmemmap_remap_free/alloc are relevant to HugeTLB, so move those functiongs to the scope of CONFIG_HUGETLB_PAGE_FREE_VMEMMAP. Signed-off-by: Muchun Song Reviewed-by: Barry Song --- include/linux/mm.h | 2 ++ mm/sparse-vmemmap.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index a7e4a9e7d807..8c85863a067c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3184,10 +3184,12 @@ static inline void print_vma_addr(char *prefix, unsigned long rip) } #endif +#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP int vmemmap_remap_free(unsigned long start, unsigned long end, unsigned long reuse); int vmemmap_remap_alloc(unsigned long start, unsigned long end, unsigned long reuse, gfp_t gfp_mask); +#endif void *sparse_buffer_alloc(unsigned long size); struct page * __populate_section_memmap(unsigned long pfn, diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index c64d1aa3c4b5..8aecd6b3896c 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -34,6 +34,7 @@ #include #include +#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP /** * struct vmemmap_remap_walk - walk vmemmap page table * @@ -419,6 +420,7 @@ int vmemmap_remap_alloc(unsigned long start, unsigned long end, return 0; } +#endif /* CONFIG_HUGETLB_PAGE_FREE_VMEMMAP */ /* * Allocate a block of memory to be used to back the virtual memory map