提交 8a04737c 编写于 作者: Z Zhou Guanghui 提交者: Yang Yingliang

Ascend/memcg: Use CONFIG_ASCEND_FEATURES for customized interfaces

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4D63I
CVE: NA

-------------------------------------------------------------

The following functions are used only in the ascend scenario:
hugetlb_get_hstate,
hugetlb_alloc_hugepage,
hugetlb_insert_hugepage_pte,
hugetlb_insert_hugepage_pte_by_pa

Remove unused interface hugetlb_insert_hugepage
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Signed-off-by: NGuo Mengqi <guomengqi3@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 63051041
......@@ -373,11 +373,27 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
pgoff_t idx);
#ifdef CONFIG_ARM64
#ifdef CONFIG_ASCEND_FEATURES
const struct hstate *hugetlb_get_hstate(void);
struct page *hugetlb_alloc_hugepage(int nid);
int hugetlb_insert_hugepage_pte(struct mm_struct *mm, unsigned long addr,
pgprot_t prot, struct page *hpage);
#else
static inline const struct hstate *hugetlb_get_hstate(void)
{
return NULL;
}
static inline struct page *hugetlb_alloc_hugepage(int nid)
{
return NULL;
}
static inline int hugetlb_insert_hugepage_pte(struct mm_struct *mm,
unsigned long addr, pgprot_t prot, struct page *hpage)
{
return -EPERM;
}
#endif
/* arch callback */
......@@ -614,12 +630,6 @@ static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr
{
}
static inline int hugetlb_insert_hugepage_pte_by_pa(struct mm_struct *mm,
unsigned long vir_addr,
pgprot_t prot, unsigned long phy_addr)
{
return 0;
}
#endif /* CONFIG_HUGETLB_PAGE */
static inline spinlock_t *huge_pte_lock(struct hstate *h,
......@@ -632,4 +642,13 @@ static inline spinlock_t *huge_pte_lock(struct hstate *h,
return ptl;
}
#ifndef CONFIG_ASCEND_FEATURES
static inline int hugetlb_insert__hugepage_pte_by_pa(struct mm_struct *mm,
unsigned long vir_addr,
pgprot_t prot, unsigned long phy_addr)
{
return -EPERM;
}
#endif
#endif /* _LINUX_HUGETLB_H */
......@@ -5227,7 +5227,7 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason)
}
}
#ifdef CONFIG_ARM64
#ifdef CONFIG_ASCEND_FEATURES
const struct hstate *hugetlb_get_hstate(void)
{
return &default_hstate;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册