From patchwork Tue Sep 28 12:41: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: 12522455 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 68DFDC433EF for ; Tue, 28 Sep 2021 12:43:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A9EB60E54 for ; Tue, 28 Sep 2021 12:43:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0A9EB60E54 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 A6CD6900008; Tue, 28 Sep 2021 08:43:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F519900002; Tue, 28 Sep 2021 08:43:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8987B900008; Tue, 28 Sep 2021 08:43:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0020.hostedemail.com [216.40.44.20]) by kanga.kvack.org (Postfix) with ESMTP id 76DF9900002 for ; Tue, 28 Sep 2021 08:43:14 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2F68F2FE17 for ; Tue, 28 Sep 2021 12:43:14 +0000 (UTC) X-FDA: 78636947508.05.DF26847 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf21.hostedemail.com (Postfix) with ESMTP id D355BD032D43 for ; Tue, 28 Sep 2021 12:43:13 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id ce20-20020a17090aff1400b0019f13f6a749so1374311pjb.4 for ; Tue, 28 Sep 2021 05:43:13 -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=0LAyp9r8bOnwik80mbEioL/ye7jfFZ1gOmLErvcKKTI=; b=PZHYivOVjs95VPpnWAgIp+6wL2rO4Ei1SF0+27DUnepUrm/zMtRtbU2mlqVRY+S+rA WRC6aCYL7YVeOOL4f+Su0wYtNgIfZO4XjOkC/AfgbjLb33+gN/mK7v6hWZTFPdWfyBb4 y5wCkJC/tBASlA2Q+PAXCQtkDkcht+yuoPr06set4eSvacjapOusf94iiGD5QhwyB2Hx xq3Gwr95haRW+fg4am3pCo4Y4qBKo1v1N48C7ZLMj/9H4I7/wwxNNvU4D/M99CAK9Q5X QTnpNehLBkPuY0sE2GYO28xP9feWQH+OVCHqpJ+rbPxj7roisp7IdHRwnuRUB+krQVJy Y5nw== 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=0LAyp9r8bOnwik80mbEioL/ye7jfFZ1gOmLErvcKKTI=; b=wA3iVf74U4K/bBv7qzOdGwibcoKRWov1JZpGRmmV0hbldW7UbyUR6IBA0fBIfl8cM6 nHXZEA8wRoI4AOdXKypN+kSUFnCa+yrrzGS5JTx9wZrgYZFAsbYSfc20eOKlCozou2tN WCkNHDZSlcC1hrK1qpgtSw+InaL+a9ZKqUAvSjP/locHOXVbN1QyCKKc2RvnFCdldrUw UWvCn3sO26uV3ZT6awxOwAEe3pj7oAVu2pH66pxF7CkS0bitNYRf6TY452SqnNetBKu+ 9ruwwfqXAml5rtlV5mZSyoty5iX46IoLChNUXPIGtLNbO0CwkAT680tRvLqIWNSSP5Sf AKLA== X-Gm-Message-State: AOAM531JQNXP+jf3Lp5FCC2cSdR4THrywieQrqNRqHLr7a8O+ZeXVyDo SZzF1/V80lRwpL/mk0gTmlNiqw== X-Google-Smtp-Source: ABdhPJyZWXa2EClSDC6dnvkI3nryJK9ZCpSndKPVprcLvqe+9w4aBO4h5eUHs1nGNfjmVqKd7FShJQ== X-Received: by 2002:a17:90a:c914:: with SMTP id v20mr5330329pjt.208.1632832992907; Tue, 28 Sep 2021 05:43:12 -0700 (PDT) Received: from localhost.localdomain ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id s17sm10055287pge.50.2021.09.28.05.43.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Sep 2021 05:43:12 -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 v5 5/5] mm: sparsemem: move vmemmap related to HugeTLB to CONFIG_HUGETLB_PAGE_FREE_VMEMMAP Date: Tue, 28 Sep 2021 20:41:52 +0800 Message-Id: <20210928124152.33634-6-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210928124152.33634-1-songmuchun@bytedance.com> References: <20210928124152.33634-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: D355BD032D43 X-Stat-Signature: 1jzsruzrkras4386r773abgr7f7pdy9w Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=PZHYivOV; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf21.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-HE-Tag: 1632832993-622094 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 ba76d8765211..ad73650809ed 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