hugetlb_vmemmap.h (b65d4adbc0f0d4619f61ee9d8126bc5005b78802) hugetlb_vmemmap.h (ad2fa3717b74994a22519dbe045757135db00dbb)
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
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
14int alloc_huge_page_vmemmap(struct hstate *h, struct page *head);
14void free_huge_page_vmemmap(struct hstate *h, struct page *head);
15
16/*
17 * How many vmemmap pages associated with a HugeTLB page that can be freed
18 * to the buddy allocator.
19 *
20 * Todo: Returns zero for now, which means the feature is disabled. We will
21 * enable it once all the infrastructure is there.
22 */
23static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
24{
25 return 0;
26}
27#else
15void free_huge_page_vmemmap(struct hstate *h, struct page *head);
16
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}
28#else
29static inline int alloc_huge_page_vmemmap(struct hstate *h, struct page *head)
30{
31 return 0;
32}
33
28static inline void free_huge_page_vmemmap(struct hstate *h, struct page *head)
29{
30}
31
32static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
33{
34 return 0;
35}
36#endif /* CONFIG_HUGETLB_PAGE_FREE_VMEMMAP */
37#endif /* _LINUX_HUGETLB_VMEMMAP_H */
34static inline void free_huge_page_vmemmap(struct hstate *h, struct page *head)
35{
36}
37
38static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
39{
40 return 0;
41}
42#endif /* CONFIG_HUGETLB_PAGE_FREE_VMEMMAP */
43#endif /* _LINUX_HUGETLB_VMEMMAP_H */