]> git.ipfire.org Git - people/ms/linux.git/blob - mm/hugetlb_vmemmap.h
Merge tag 'x86-mm-2022-06-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
[people/ms/linux.git] / mm / hugetlb_vmemmap.h
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Optimize vmemmap pages associated with 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_OPTIMIZE_VMEMMAP
14 int hugetlb_vmemmap_alloc(struct hstate *h, struct page *head);
15 void hugetlb_vmemmap_free(struct hstate *h, struct page *head);
16 void hugetlb_vmemmap_init(struct hstate *h);
17
18 /*
19 * How many vmemmap pages associated with a HugeTLB page that can be
20 * optimized and freed to the buddy allocator.
21 */
22 static inline unsigned int hugetlb_optimize_vmemmap_pages(struct hstate *h)
23 {
24 return h->optimize_vmemmap_pages;
25 }
26 #else
27 static inline int hugetlb_vmemmap_alloc(struct hstate *h, struct page *head)
28 {
29 return 0;
30 }
31
32 static inline void hugetlb_vmemmap_free(struct hstate *h, struct page *head)
33 {
34 }
35
36 static inline void hugetlb_vmemmap_init(struct hstate *h)
37 {
38 }
39
40 static inline unsigned int hugetlb_optimize_vmemmap_pages(struct hstate *h)
41 {
42 return 0;
43 }
44 #endif /* CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP */
45 #endif /* _LINUX_HUGETLB_VMEMMAP_H */