Muchun Song | f41f2ed | 2021-06-30 18:47:13 -0700 | [diff] [blame] | 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 |
Muchun Song | ad2fa37 | 2021-06-30 18:47:21 -0700 | [diff] [blame^] | 14 | int alloc_huge_page_vmemmap(struct hstate *h, struct page *head); |
Muchun Song | f41f2ed | 2021-06-30 18:47:13 -0700 | [diff] [blame] | 15 | void free_huge_page_vmemmap(struct hstate *h, struct page *head); |
Muchun Song | b65d4ad | 2021-06-30 18:47:17 -0700 | [diff] [blame] | 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 | */ |
| 24 | static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h) |
| 25 | { |
| 26 | return 0; |
| 27 | } |
Muchun Song | f41f2ed | 2021-06-30 18:47:13 -0700 | [diff] [blame] | 28 | #else |
Muchun Song | ad2fa37 | 2021-06-30 18:47:21 -0700 | [diff] [blame^] | 29 | static inline int alloc_huge_page_vmemmap(struct hstate *h, struct page *head) |
| 30 | { |
| 31 | return 0; |
| 32 | } |
| 33 | |
Muchun Song | f41f2ed | 2021-06-30 18:47:13 -0700 | [diff] [blame] | 34 | static inline void free_huge_page_vmemmap(struct hstate *h, struct page *head) |
| 35 | { |
| 36 | } |
Muchun Song | b65d4ad | 2021-06-30 18:47:17 -0700 | [diff] [blame] | 37 | |
| 38 | static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h) |
| 39 | { |
| 40 | return 0; |
| 41 | } |
Muchun Song | f41f2ed | 2021-06-30 18:47:13 -0700 | [diff] [blame] | 42 | #endif /* CONFIG_HUGETLB_PAGE_FREE_VMEMMAP */ |
| 43 | #endif /* _LINUX_HUGETLB_VMEMMAP_H */ |