From patchwork Sun Sep 26 03:13:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12517893 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 DF3B0C433F5 for ; Sun, 26 Sep 2021 03:15:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8C9F261029 for ; Sun, 26 Sep 2021 03:15:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8C9F261029 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 2D8FA6B0078; Sat, 25 Sep 2021 23:15:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 288376B007B; Sat, 25 Sep 2021 23:15:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 176DA6B007D; Sat, 25 Sep 2021 23:15:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 09AEB6B0078 for ; Sat, 25 Sep 2021 23:15:29 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B156B180D0797 for ; Sun, 26 Sep 2021 03:15:28 +0000 (UTC) X-FDA: 78628259136.14.6CC3BCF Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by imf25.hostedemail.com (Postfix) with ESMTP id 76040B00008E for ; Sun, 26 Sep 2021 03:15:28 +0000 (UTC) Received: by mail-pg1-f171.google.com with SMTP id w8so14204595pgf.5 for ; Sat, 25 Sep 2021 20:15:28 -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=lBVREcbULLdqaPu2xVXA/zzEvcIr2XcW00aGGgEt1R0=; b=AIt908PRuKK8faRpMJ6vdoIzcoydx21Jsb8fY7MrXRpJmjdkBtjzxlfPQLHCUXvqZK DVOLTHIHa8EYlxC1ziWx5RVNhDDrFwtVgEJQavOLkucLoYFg91hCTvk+edMhvHzWrzIA qQY+h1deTymLNbzXPLNvYsUXEHylU81xQ3UJP+oaphv2oWJ+6UeGctVlXDvL2XAL/2rQ 8VzPBewHjvvhGKcAJOcTB2cHkrRdvEJ+xEI+574MDWiFtj3KE5Q8Nu4SkeXEfdOwxFYp QwMMm5vMMTeU+ytG6apzi2wRMvgqQM+kyH78VD9nQGBel77Duf619wZr/sYVdj+wlF0g /ndA== 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=lBVREcbULLdqaPu2xVXA/zzEvcIr2XcW00aGGgEt1R0=; b=vko4+Mpqq8sn8JpzO5HrMJOpkIQRa9oPWvDB+n8VcT4KCbKMVK1WPv42aUmTyrAalm QZ3iNR72PEdC8F1T3C5ncnBeC8YzP0AG9YP/9W1mKMb6jPitZ5GeNn9w5kaDlxe0xK3y u6hbRDsBgPx1IV+DkgY3vC6WCo/N3zeyLANChsTtBPdGJnqaftRCwkRqDYnn2QkTRbn8 rAlcXSsJibZwG1Vm/ZSgka4V0I32D0n8ErSOaMjrpaMBjIIsOEMguXsqfvRxhCvoSXHU ifyIU19glokx3A0+OnYWd5/ZHVhpCR6Twvqjl/IRDzrqlzFR2HuK0ruKn3e9Lu6ynsbj MsDQ== X-Gm-Message-State: AOAM530sJSftOOkpgZqC8NYLyeTETl1bZIN8v0z7VpJok7IfBOiRpcWq av+u+/hQM9K/k07kZOOweef91A== X-Google-Smtp-Source: ABdhPJy4n8ITV5TO8x69HoiW/b5VWS7o6Hbt05+tkS6I4fn84pt8iljnvISDWFvfVDkdcEfSaiBJJg== X-Received: by 2002:a65:640f:: with SMTP id a15mr510106pgv.106.1632626127582; Sat, 25 Sep 2021 20:15:27 -0700 (PDT) Received: from localhost.localdomain ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id v26sm13374862pfm.175.2021.09.25.20.15.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Sep 2021 20:15:27 -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 v4 5/5] mm: sparsemem: move vmemmap related to HugeTLB to CONFIG_HUGETLB_PAGE_FREE_VMEMMAP Date: Sun, 26 Sep 2021 11:13:39 +0800 Message-Id: <20210926031339.40043-6-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210926031339.40043-1-songmuchun@bytedance.com> References: <20210926031339.40043-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 76040B00008E X-Stat-Signature: p4w5taw9wmkdsuc7jmpqgxei4fj6s9p5 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=AIt908PR; spf=pass (imf25.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.215.171 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-HE-Tag: 1632626128-701050 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 00bb2d938df4..a706e7ffda94 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3182,10 +3182,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 d486a7a48512..3c7dd41c3164 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 * @@ -423,6 +424,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