2021-07-01 04:47:13 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/*
|
|
|
|
* Free some vmemmap pages of HugeTLB
|
|
|
|
*
|
|
|
|
* Copyright (c) 2020, Bytedance. All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Muchun Song <songmuchun@bytedance.com>
|
|
|
|
*/
|
|
|
|
#ifndef _LINUX_HUGETLB_VMEMMAP_H
|
|
|
|
#define _LINUX_HUGETLB_VMEMMAP_H
|
|
|
|
#include <linux/hugetlb.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP
|
2021-07-01 04:47:21 +03:00
|
|
|
int alloc_huge_page_vmemmap(struct hstate *h, struct page *head);
|
2021-07-01 04:47:13 +03:00
|
|
|
void free_huge_page_vmemmap(struct hstate *h, struct page *head);
|
2021-07-01 04:47:33 +03:00
|
|
|
void hugetlb_vmemmap_init(struct hstate *h);
|
2021-07-01 04:47:17 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* How many vmemmap pages associated with a HugeTLB page that can be freed
|
|
|
|
* to the buddy allocator.
|
|
|
|
*/
|
|
|
|
static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
|
|
|
|
{
|
2021-07-01 04:47:33 +03:00
|
|
|
return h->nr_free_vmemmap_pages;
|
2021-07-01 04:47:17 +03:00
|
|
|
}
|
2021-07-01 04:47:13 +03:00
|
|
|
#else
|
2021-07-01 04:47:21 +03:00
|
|
|
static inline int alloc_huge_page_vmemmap(struct hstate *h, struct page *head)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-07-01 04:47:13 +03:00
|
|
|
static inline void free_huge_page_vmemmap(struct hstate *h, struct page *head)
|
|
|
|
{
|
|
|
|
}
|
2021-07-01 04:47:17 +03:00
|
|
|
|
2021-07-01 04:47:33 +03:00
|
|
|
static inline void hugetlb_vmemmap_init(struct hstate *h)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-07-01 04:47:17 +03:00
|
|
|
static inline unsigned int free_vmemmap_pages_per_hpage(struct hstate *h)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2021-07-01 04:47:13 +03:00
|
|
|
#endif /* CONFIG_HUGETLB_PAGE_FREE_VMEMMAP */
|
|
|
|
#endif /* _LINUX_HUGETLB_VMEMMAP_H */
|