]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - mm/hugetlb_vmemmap.h
x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data
[mirror_ubuntu-jammy-kernel.git] / mm / hugetlb_vmemmap.h
CommitLineData
f41f2ed4
MS
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Free some vmemmap pages of HugeTLB
4 *
5 * Copyright (c) 2020, Bytedance. All rights reserved.
6 *
7 * Author: Muchun Song <songmuchun@bytedance.com>
8 */
9#ifndef _LINUX_HUGETLB_VMEMMAP_H
10#define _LINUX_HUGETLB_VMEMMAP_H
11#include <linux/hugetlb.h>
12
13#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
ad2fa371 14int alloc_huge_page_vmemmap(struct hstate *h, struct page *head);
f41f2ed4 15void free_huge_page_vmemmap(struct hstate *h, struct page *head);
77490587 16void hugetlb_vmemmap_init(struct hstate *h);
b65d4adb
MS
17
18/*
19 * How many vmemmap pages associated with a HugeTLB page that can be freed
20 * to the buddy allocator.
b65d4adb
MS
21 */
22static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
23{
77490587 24 return h->nr_free_vmemmap_pages;
b65d4adb 25}
f41f2ed4 26#else
ad2fa371
MS
27static inline int alloc_huge_page_vmemmap(struct hstate *h, struct page *head)
28{
29 return 0;
30}
31
f41f2ed4
MS
32static inline void free_huge_page_vmemmap(struct hstate *h, struct page *head)
33{
34}
b65d4adb 35
77490587
MS
36static inline void hugetlb_vmemmap_init(struct hstate *h)
37{
38}
39
b65d4adb
MS
40static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
41{
42 return 0;
43}
f41f2ed4
MS
44#endif /* CONFIG_HUGETLB_PAGE_FREE_VMEMMAP */
45#endif /* _LINUX_HUGETLB_VMEMMAP_H */