blob: a37771b0b82ac9fb36db2c7990a5af04c1e979eb [file] [log] [blame]
Muchun Songf41f2ed2021-06-30 18:47:13 -07001// 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
Muchun Songad2fa372021-06-30 18:47:21 -070014int alloc_huge_page_vmemmap(struct hstate *h, struct page *head);
Muchun Songf41f2ed2021-06-30 18:47:13 -070015void free_huge_page_vmemmap(struct hstate *h, struct page *head);
Muchun Songb65d4ad2021-06-30 18:47:17 -070016
17/*
18 * How many vmemmap pages associated with a HugeTLB page that can be freed
19 * to the buddy allocator.
20 *
21 * Todo: Returns zero for now, which means the feature is disabled. We will
22 * enable it once all the infrastructure is there.
23 */
24static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
25{
26 return 0;
27}
Muchun Songf41f2ed2021-06-30 18:47:13 -070028#else
Muchun Songad2fa372021-06-30 18:47:21 -070029static inline int alloc_huge_page_vmemmap(struct hstate *h, struct page *head)
30{
31 return 0;
32}
33
Muchun Songf41f2ed2021-06-30 18:47:13 -070034static inline void free_huge_page_vmemmap(struct hstate *h, struct page *head)
35{
36}
Muchun Songb65d4ad2021-06-30 18:47:17 -070037
38static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
39{
40 return 0;
41}
Muchun Songf41f2ed2021-06-30 18:47:13 -070042#endif /* CONFIG_HUGETLB_PAGE_FREE_VMEMMAP */
43#endif /* _LINUX_HUGETLB_VMEMMAP_H */