2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-16 15:20:36 -07:00
|
|
|
#ifndef _LINUX_HUGETLB_H
|
|
|
|
|
#define _LINUX_HUGETLB_H
|
|
|
|
|
|
2011-05-26 12:03:50 -07:00
|
|
|
#include <linux/mm_types.h>
|
2014-01-23 15:52:54 -08:00
|
|
|
#include <linux/mmdebug.h>
|
2007-07-30 02:36:13 +04:00
|
|
|
#include <linux/fs.h>
|
2010-05-28 09:29:15 +09:00
|
|
|
#include <linux/hugetlb_inline.h>
|
2012-07-31 16:42:24 -07:00
|
|
|
#include <linux/cgroup.h>
|
2014-04-03 14:47:25 -07:00
|
|
|
#include <linux/list.h>
|
|
|
|
|
#include <linux/kref.h>
|
2016-01-15 16:56:32 -08:00
|
|
|
#include <asm/pgtable.h>
|
2007-07-30 02:36:13 +04:00
|
|
|
|
2009-09-24 14:47:45 -07:00
|
|
|
struct ctl_table;
|
|
|
|
|
struct user_struct;
|
2012-07-31 16:42:03 -07:00
|
|
|
struct mmu_gather;
|
2009-09-24 14:47:45 -07:00
|
|
|
|
2017-07-06 15:38:53 -07:00
|
|
|
#ifndef is_hugepd
|
|
|
|
|
typedef struct { unsigned long pd; } hugepd_t;
|
|
|
|
|
#define is_hugepd(hugepd) (0)
|
|
|
|
|
#define __hugepd(x) ((hugepd_t) { (x) })
|
|
|
|
|
#endif
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#ifdef CONFIG_HUGETLB_PAGE
|
|
|
|
|
|
|
|
|
|
#include <linux/mempolicy.h>
|
2007-03-01 15:46:08 -08:00
|
|
|
#include <linux/shm.h>
|
2005-06-21 17:14:44 -07:00
|
|
|
#include <asm/tlbflush.h>
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-03-21 16:34:12 -07:00
|
|
|
struct hugepage_subpool {
|
|
|
|
|
spinlock_t lock;
|
|
|
|
|
long count;
|
2015-04-15 16:13:36 -07:00
|
|
|
long max_hpages; /* Maximum huge pages or -1 if no maximum. */
|
|
|
|
|
long used_hpages; /* Used count against maximum, includes */
|
|
|
|
|
/* both alloced and reserved pages. */
|
|
|
|
|
struct hstate *hstate;
|
|
|
|
|
long min_hpages; /* Minimum huge pages or -1 if no minimum. */
|
|
|
|
|
long rsv_hpages; /* Pages reserved against global pool to */
|
|
|
|
|
/* sasitfy minimum size. */
|
2012-03-21 16:34:12 -07:00
|
|
|
};
|
|
|
|
|
|
2014-04-03 14:47:25 -07:00
|
|
|
struct resv_map {
|
|
|
|
|
struct kref refs;
|
2014-04-03 14:47:27 -07:00
|
|
|
spinlock_t lock;
|
2014-04-03 14:47:25 -07:00
|
|
|
struct list_head regions;
|
2015-09-08 15:01:28 -07:00
|
|
|
long adds_in_progress;
|
|
|
|
|
struct list_head region_cache;
|
|
|
|
|
long region_cache_count;
|
2014-04-03 14:47:25 -07:00
|
|
|
};
|
|
|
|
|
extern struct resv_map *resv_map_alloc(void);
|
|
|
|
|
void resv_map_release(struct kref *ref);
|
|
|
|
|
|
2012-07-31 16:42:10 -07:00
|
|
|
extern spinlock_t hugetlb_lock;
|
|
|
|
|
extern int hugetlb_max_hstate __read_mostly;
|
|
|
|
|
#define for_each_hstate(h) \
|
|
|
|
|
for ((h) = hstates; (h) < &hstates[hugetlb_max_hstate]; (h)++)
|
|
|
|
|
|
2015-04-15 16:13:42 -07:00
|
|
|
struct hugepage_subpool *hugepage_new_subpool(struct hstate *h, long max_hpages,
|
|
|
|
|
long min_hpages);
|
2012-03-21 16:34:12 -07:00
|
|
|
void hugepage_put_subpool(struct hugepage_subpool *spool);
|
|
|
|
|
|
2008-07-23 21:27:23 -07:00
|
|
|
void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
|
2009-09-23 15:57:19 -07:00
|
|
|
int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
|
|
|
|
|
int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
|
|
|
|
|
int hugetlb_treat_movable_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
|
2009-12-14 17:58:21 -08:00
|
|
|
|
|
|
|
|
#ifdef CONFIG_NUMA
|
|
|
|
|
int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
|
|
|
|
|
void __user *, size_t *, loff_t *);
|
|
|
|
|
#endif
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
|
2013-02-22 16:35:55 -08:00
|
|
|
long follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *,
|
|
|
|
|
struct page **, struct vm_area_struct **,
|
2017-02-22 15:43:13 -08:00
|
|
|
unsigned long *, unsigned long *, long, unsigned int,
|
|
|
|
|
int *);
|
2008-07-23 21:27:25 -07:00
|
|
|
void unmap_hugepage_range(struct vm_area_struct *,
|
2012-07-31 16:42:03 -07:00
|
|
|
unsigned long, unsigned long, struct page *);
|
2012-07-31 16:46:20 -07:00
|
|
|
void __unmap_hugepage_range_final(struct mmu_gather *tlb,
|
|
|
|
|
struct vm_area_struct *vma,
|
|
|
|
|
unsigned long start, unsigned long end,
|
|
|
|
|
struct page *ref_page);
|
2012-07-31 16:42:03 -07:00
|
|
|
void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,
|
|
|
|
|
unsigned long start, unsigned long end,
|
|
|
|
|
struct page *ref_page);
|
2008-10-15 23:50:22 +04:00
|
|
|
void hugetlb_report_meminfo(struct seq_file *);
|
2005-04-16 15:20:36 -07:00
|
|
|
int hugetlb_report_node_meminfo(int, char *);
|
2013-04-29 15:07:48 -07:00
|
|
|
void hugetlb_show_meminfo(void);
|
2005-04-16 15:20:36 -07:00
|
|
|
unsigned long hugetlb_total_pages(void);
|
2018-08-23 17:01:36 -07:00
|
|
|
vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
|
2009-06-23 13:49:05 +01:00
|
|
|
unsigned long address, unsigned int flags);
|
2017-02-22 15:42:52 -08:00
|
|
|
int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte,
|
|
|
|
|
struct vm_area_struct *dst_vma,
|
|
|
|
|
unsigned long dst_addr,
|
|
|
|
|
unsigned long src_addr,
|
|
|
|
|
struct page **pagep);
|
2008-07-23 21:27:23 -07:00
|
|
|
int hugetlb_reserve_pages(struct inode *inode, long from, long to,
|
2009-02-10 14:02:27 +00:00
|
|
|
struct vm_area_struct *vma,
|
2011-05-26 19:16:19 +09:00
|
|
|
vm_flags_t vm_flags);
|
2015-09-08 15:01:41 -07:00
|
|
|
long hugetlb_unreserve_pages(struct inode *inode, long start, long end,
|
|
|
|
|
long freed);
|
2013-09-11 14:21:59 -07:00
|
|
|
bool isolate_huge_page(struct page *page, struct list_head *list);
|
|
|
|
|
void putback_active_hugepage(struct page *page);
|
2018-01-31 16:20:48 -08:00
|
|
|
void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason);
|
2014-07-30 16:08:39 -07:00
|
|
|
void free_huge_page(struct page *page);
|
2016-10-07 17:02:01 -07:00
|
|
|
void hugetlb_fix_reserve_counts(struct inode *inode);
|
2015-09-08 15:01:35 -07:00
|
|
|
extern struct mutex *hugetlb_fault_mutex_table;
|
2019-11-30 17:57:02 -08:00
|
|
|
u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-04-23 12:35:02 +01:00
|
|
|
pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
extern int sysctl_hugetlb_shm_group;
|
2008-07-23 21:27:52 -07:00
|
|
|
extern struct list_head huge_boot_pages;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2005-06-21 17:14:44 -07:00
|
|
|
/* arch callbacks */
|
|
|
|
|
|
2008-07-23 21:27:41 -07:00
|
|
|
pte_t *huge_pte_alloc(struct mm_struct *mm,
|
|
|
|
|
unsigned long addr, unsigned long sz);
|
2017-07-06 15:39:42 -07:00
|
|
|
pte_t *huge_pte_offset(struct mm_struct *mm,
|
|
|
|
|
unsigned long addr, unsigned long sz);
|
2006-12-06 20:32:03 -08:00
|
|
|
int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep);
|
2018-10-05 15:51:29 -07:00
|
|
|
void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
|
|
|
|
|
unsigned long *start, unsigned long *end);
|
2005-06-21 17:14:44 -07:00
|
|
|
struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address,
|
|
|
|
|
int write);
|
2017-07-06 15:38:56 -07:00
|
|
|
struct page *follow_huge_pd(struct vm_area_struct *vma,
|
|
|
|
|
unsigned long address, hugepd_t hpd,
|
|
|
|
|
int flags, int pdshift);
|
2005-06-21 17:14:44 -07:00
|
|
|
struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
|
2015-02-11 15:25:22 -08:00
|
|
|
pmd_t *pmd, int flags);
|
2008-07-23 21:27:50 -07:00
|
|
|
struct page *follow_huge_pud(struct mm_struct *mm, unsigned long address,
|
2015-02-11 15:25:22 -08:00
|
|
|
pud_t *pud, int flags);
|
2017-07-06 15:38:50 -07:00
|
|
|
struct page *follow_huge_pgd(struct mm_struct *mm, unsigned long address,
|
|
|
|
|
pgd_t *pgd, int flags);
|
|
|
|
|
|
2005-06-21 17:14:44 -07:00
|
|
|
int pmd_huge(pmd_t pmd);
|
2017-03-09 17:24:07 +03:00
|
|
|
int pud_huge(pud_t pud);
|
2012-11-19 03:14:23 +01:00
|
|
|
unsigned long hugetlb_change_protection(struct vm_area_struct *vma,
|
2006-03-22 00:08:50 -08:00
|
|
|
unsigned long address, unsigned long end, pgprot_t newprot);
|
2005-06-21 17:14:44 -07:00
|
|
|
|
2017-07-06 15:38:47 -07:00
|
|
|
bool is_hugetlb_entry_migration(pte_t pte);
|
2018-01-31 16:20:48 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#else /* !CONFIG_HUGETLB_PAGE */
|
|
|
|
|
|
2008-07-23 21:27:23 -07:00
|
|
|
static inline void reset_vma_resv_huge_pages(struct vm_area_struct *vma)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
static inline unsigned long hugetlb_total_pages(void)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-05 15:51:29 -07:00
|
|
|
static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr,
|
|
|
|
|
pte_t *ptep)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void adjust_range_if_pmd_sharing_possible(
|
|
|
|
|
struct vm_area_struct *vma,
|
|
|
|
|
unsigned long *start, unsigned long *end)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-30 17:56:40 -08:00
|
|
|
static inline long follow_hugetlb_page(struct mm_struct *mm,
|
|
|
|
|
struct vm_area_struct *vma, struct page **pages,
|
|
|
|
|
struct vm_area_struct **vmas, unsigned long *position,
|
|
|
|
|
unsigned long *nr_pages, long i, unsigned int flags,
|
|
|
|
|
int *nonblocking)
|
|
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct page *follow_huge_addr(struct mm_struct *mm,
|
|
|
|
|
unsigned long address, int write)
|
|
|
|
|
{
|
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int copy_hugetlb_page_range(struct mm_struct *dst,
|
|
|
|
|
struct mm_struct *src, struct vm_area_struct *vma)
|
|
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-15 23:50:22 +04:00
|
|
|
static inline void hugetlb_report_meminfo(struct seq_file *m)
|
|
|
|
|
{
|
|
|
|
|
}
|
2019-11-30 17:56:40 -08:00
|
|
|
|
|
|
|
|
static inline int hugetlb_report_node_meminfo(int nid, char *buf)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-29 15:07:48 -07:00
|
|
|
static inline void hugetlb_show_meminfo(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
2019-11-30 17:56:40 -08:00
|
|
|
|
|
|
|
|
static inline struct page *follow_huge_pd(struct vm_area_struct *vma,
|
|
|
|
|
unsigned long address, hugepd_t hpd, int flags,
|
|
|
|
|
int pdshift)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct page *follow_huge_pmd(struct mm_struct *mm,
|
|
|
|
|
unsigned long address, pmd_t *pmd, int flags)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct page *follow_huge_pud(struct mm_struct *mm,
|
|
|
|
|
unsigned long address, pud_t *pud, int flags)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct page *follow_huge_pgd(struct mm_struct *mm,
|
|
|
|
|
unsigned long address, pgd_t *pgd, int flags)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int prepare_hugepage_range(struct file *file,
|
|
|
|
|
unsigned long addr, unsigned long len)
|
|
|
|
|
{
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int pmd_huge(pmd_t pmd)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int pud_huge(pud_t pud)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int is_hugepage_only_range(struct mm_struct *mm,
|
|
|
|
|
unsigned long addr, unsigned long len)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb,
|
|
|
|
|
unsigned long addr, unsigned long end,
|
|
|
|
|
unsigned long floor, unsigned long ceiling)
|
|
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
|
|
|
|
|
pte_t *dst_pte,
|
|
|
|
|
struct vm_area_struct *dst_vma,
|
|
|
|
|
unsigned long dst_addr,
|
|
|
|
|
unsigned long src_addr,
|
|
|
|
|
struct page **pagep)
|
|
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr,
|
|
|
|
|
unsigned long sz)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2012-07-31 16:42:03 -07:00
|
|
|
|
2013-12-12 17:12:19 -08:00
|
|
|
static inline bool isolate_huge_page(struct page *page, struct list_head *list)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-11-30 17:56:40 -08:00
|
|
|
static inline void putback_active_hugepage(struct page *page)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void move_hugetlb_state(struct page *oldpage,
|
|
|
|
|
struct page *newpage, int reason)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned long hugetlb_change_protection(
|
|
|
|
|
struct vm_area_struct *vma, unsigned long address,
|
|
|
|
|
unsigned long end, pgprot_t newprot)
|
2012-11-19 03:14:23 +01:00
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2006-03-22 00:08:50 -08:00
|
|
|
|
2012-07-31 16:46:20 -07:00
|
|
|
static inline void __unmap_hugepage_range_final(struct mmu_gather *tlb,
|
|
|
|
|
struct vm_area_struct *vma, unsigned long start,
|
|
|
|
|
unsigned long end, struct page *ref_page)
|
|
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-31 16:42:03 -07:00
|
|
|
static inline void __unmap_hugepage_range(struct mmu_gather *tlb,
|
|
|
|
|
struct vm_area_struct *vma, unsigned long start,
|
|
|
|
|
unsigned long end, struct page *ref_page)
|
|
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
}
|
2019-11-30 17:56:40 -08:00
|
|
|
|
2019-03-28 20:43:51 -07:00
|
|
|
static inline vm_fault_t hugetlb_fault(struct mm_struct *mm,
|
2019-11-30 17:56:40 -08:00
|
|
|
struct vm_area_struct *vma, unsigned long address,
|
|
|
|
|
unsigned int flags)
|
2019-03-28 20:43:51 -07:00
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2012-07-31 16:42:03 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif /* !CONFIG_HUGETLB_PAGE */
|
2014-11-05 21:57:40 +05:30
|
|
|
/*
|
|
|
|
|
* hugepages at page global directory. If arch support
|
|
|
|
|
* hugepages at pgd level, they need to define this.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef pgd_huge
|
|
|
|
|
#define pgd_huge(x) 0
|
|
|
|
|
#endif
|
2017-03-09 17:24:07 +03:00
|
|
|
#ifndef p4d_huge
|
|
|
|
|
#define p4d_huge(x) 0
|
|
|
|
|
#endif
|
2014-11-05 21:57:40 +05:30
|
|
|
|
|
|
|
|
#ifndef pgd_write
|
|
|
|
|
static inline int pgd_write(pgd_t pgd)
|
|
|
|
|
{
|
|
|
|
|
BUG();
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-09-21 17:03:47 -07:00
|
|
|
#define HUGETLB_ANON_FILE "anon_hugepage"
|
|
|
|
|
|
2009-09-21 17:03:43 -07:00
|
|
|
enum {
|
|
|
|
|
/*
|
|
|
|
|
* The file will be used as an shm file so shmfs accounting rules
|
|
|
|
|
* apply
|
|
|
|
|
*/
|
|
|
|
|
HUGETLB_SHMFS_INODE = 1,
|
2009-09-21 17:03:47 -07:00
|
|
|
/*
|
|
|
|
|
* The file is being created on the internal vfs mount and shmfs
|
|
|
|
|
* accounting rules do not apply
|
|
|
|
|
*/
|
|
|
|
|
HUGETLB_ANONHUGE_INODE = 2,
|
2009-09-21 17:03:43 -07:00
|
|
|
};
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#ifdef CONFIG_HUGETLBFS
|
|
|
|
|
struct hugetlbfs_sb_info {
|
|
|
|
|
long max_inodes; /* inodes allowed */
|
|
|
|
|
long free_inodes; /* inodes free */
|
|
|
|
|
spinlock_t stat_lock;
|
2008-07-23 21:27:43 -07:00
|
|
|
struct hstate *hstate;
|
2012-03-21 16:34:12 -07:00
|
|
|
struct hugepage_subpool *spool;
|
2017-07-05 16:24:18 +01:00
|
|
|
kuid_t uid;
|
|
|
|
|
kgid_t gid;
|
|
|
|
|
umode_t mode;
|
2005-04-16 15:20:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
|
|
|
|
|
{
|
|
|
|
|
return sb->s_fs_info;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-31 16:19:22 -08:00
|
|
|
struct hugetlbfs_inode_info {
|
|
|
|
|
struct shared_policy policy;
|
|
|
|
|
struct inode vfs_inode;
|
2018-01-31 16:19:25 -08:00
|
|
|
unsigned int seals;
|
2018-01-31 16:19:22 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode)
|
|
|
|
|
{
|
|
|
|
|
return container_of(inode, struct hugetlbfs_inode_info, vfs_inode);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-28 01:56:42 -08:00
|
|
|
extern const struct file_operations hugetlbfs_file_operations;
|
2009-09-27 22:29:37 +04:00
|
|
|
extern const struct vm_operations_struct hugetlb_vm_ops;
|
2013-05-07 16:18:13 -07:00
|
|
|
struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct,
|
2012-12-11 16:01:34 -08:00
|
|
|
struct user_struct **user, int creat_flags,
|
|
|
|
|
int page_size_log);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2016-01-14 15:18:51 -08:00
|
|
|
static inline bool is_file_hugepages(struct file *file)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2007-03-01 15:46:08 -08:00
|
|
|
if (file->f_op == &hugetlbfs_file_operations)
|
2016-01-14 15:18:51 -08:00
|
|
|
return true;
|
2007-03-01 15:46:08 -08:00
|
|
|
|
2016-01-14 15:18:51 -08:00
|
|
|
return is_file_shm_hugepages(file);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
2012-12-11 16:01:34 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#else /* !CONFIG_HUGETLBFS */
|
|
|
|
|
|
2016-01-14 15:18:51 -08:00
|
|
|
#define is_file_hugepages(file) false
|
2012-03-21 16:34:14 -07:00
|
|
|
static inline struct file *
|
2013-05-07 16:18:13 -07:00
|
|
|
hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag,
|
|
|
|
|
struct user_struct **user, int creat_flags,
|
2012-12-11 16:01:34 -08:00
|
|
|
int page_size_log)
|
2009-09-24 14:47:45 -07:00
|
|
|
{
|
|
|
|
|
return ERR_PTR(-ENOSYS);
|
|
|
|
|
}
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
#endif /* !CONFIG_HUGETLBFS */
|
|
|
|
|
|
2007-05-06 14:49:00 -07:00
|
|
|
#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
|
|
|
|
|
unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
|
|
|
|
|
unsigned long len, unsigned long pgoff,
|
|
|
|
|
unsigned long flags);
|
|
|
|
|
#endif /* HAVE_ARCH_HUGETLB_UNMAPPED_AREA */
|
|
|
|
|
|
2008-07-23 21:27:41 -07:00
|
|
|
#ifdef CONFIG_HUGETLB_PAGE
|
|
|
|
|
|
2008-07-23 21:27:44 -07:00
|
|
|
#define HSTATE_NAME_LEN 32
|
2008-07-23 21:27:41 -07:00
|
|
|
/* Defines one hugetlb page size */
|
|
|
|
|
struct hstate {
|
2009-09-21 17:01:22 -07:00
|
|
|
int next_nid_to_alloc;
|
|
|
|
|
int next_nid_to_free;
|
2008-07-23 21:27:41 -07:00
|
|
|
unsigned int order;
|
|
|
|
|
unsigned long mask;
|
|
|
|
|
unsigned long max_huge_pages;
|
|
|
|
|
unsigned long nr_huge_pages;
|
|
|
|
|
unsigned long free_huge_pages;
|
|
|
|
|
unsigned long resv_huge_pages;
|
|
|
|
|
unsigned long surplus_huge_pages;
|
|
|
|
|
unsigned long nr_overcommit_huge_pages;
|
2012-07-31 16:42:07 -07:00
|
|
|
struct list_head hugepage_activelist;
|
2008-07-23 21:27:41 -07:00
|
|
|
struct list_head hugepage_freelists[MAX_NUMNODES];
|
|
|
|
|
unsigned int nr_huge_pages_node[MAX_NUMNODES];
|
|
|
|
|
unsigned int free_huge_pages_node[MAX_NUMNODES];
|
|
|
|
|
unsigned int surplus_huge_pages_node[MAX_NUMNODES];
|
2012-07-31 16:42:24 -07:00
|
|
|
#ifdef CONFIG_CGROUP_HUGETLB
|
|
|
|
|
/* cgroup control files */
|
|
|
|
|
struct cftype cgroup_files[5];
|
|
|
|
|
#endif
|
2008-07-23 21:27:44 -07:00
|
|
|
char name[HSTATE_NAME_LEN];
|
2008-07-23 21:27:41 -07:00
|
|
|
};
|
|
|
|
|
|
2008-07-23 21:27:52 -07:00
|
|
|
struct huge_bootmem_page {
|
|
|
|
|
struct list_head list;
|
|
|
|
|
struct hstate *hstate;
|
|
|
|
|
};
|
|
|
|
|
|
2015-09-08 15:01:54 -07:00
|
|
|
struct page *alloc_huge_page(struct vm_area_struct *vma,
|
|
|
|
|
unsigned long addr, int avoid_reserve);
|
2010-09-08 10:19:33 +09:00
|
|
|
struct page *alloc_huge_page_node(struct hstate *h, int nid);
|
2017-07-10 15:49:11 -07:00
|
|
|
struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid,
|
|
|
|
|
nodemask_t *nmask);
|
2018-01-31 16:21:03 -08:00
|
|
|
struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma,
|
|
|
|
|
unsigned long address);
|
2019-03-05 15:47:44 -08:00
|
|
|
struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask,
|
|
|
|
|
int nid, nodemask_t *nmask);
|
2015-09-08 15:01:50 -07:00
|
|
|
int huge_add_to_page_cache(struct page *page, struct address_space *mapping,
|
|
|
|
|
pgoff_t idx);
|
2010-09-08 10:19:33 +09:00
|
|
|
|
2008-07-23 21:27:52 -07:00
|
|
|
/* arch callback */
|
2017-07-28 10:31:25 +05:30
|
|
|
int __init __alloc_bootmem_huge_page(struct hstate *h);
|
2008-07-23 21:27:52 -07:00
|
|
|
int __init alloc_bootmem_huge_page(struct hstate *h);
|
|
|
|
|
|
2016-05-19 17:11:04 -07:00
|
|
|
void __init hugetlb_bad_size(void);
|
2008-07-23 21:27:42 -07:00
|
|
|
void __init hugetlb_add_hstate(unsigned order);
|
|
|
|
|
struct hstate *size_to_hstate(unsigned long size);
|
|
|
|
|
|
|
|
|
|
#ifndef HUGE_MAX_HSTATE
|
|
|
|
|
#define HUGE_MAX_HSTATE 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
extern struct hstate hstates[HUGE_MAX_HSTATE];
|
|
|
|
|
extern unsigned int default_hstate_idx;
|
|
|
|
|
|
|
|
|
|
#define default_hstate (hstates[default_hstate_idx])
|
2008-07-23 21:27:41 -07:00
|
|
|
|
2008-07-23 21:27:43 -07:00
|
|
|
static inline struct hstate *hstate_inode(struct inode *i)
|
2008-07-23 21:27:41 -07:00
|
|
|
{
|
2016-05-20 16:57:59 -07:00
|
|
|
return HUGETLBFS_SB(i->i_sb)->hstate;
|
2008-07-23 21:27:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct hstate *hstate_file(struct file *f)
|
|
|
|
|
{
|
2013-01-23 17:07:38 -05:00
|
|
|
return hstate_inode(file_inode(f));
|
2008-07-23 21:27:41 -07:00
|
|
|
}
|
|
|
|
|
|
2013-05-07 16:18:13 -07:00
|
|
|
static inline struct hstate *hstate_sizelog(int page_size_log)
|
|
|
|
|
{
|
|
|
|
|
if (!page_size_log)
|
|
|
|
|
return &default_hstate;
|
2014-12-10 15:44:13 -08:00
|
|
|
|
|
|
|
|
return size_to_hstate(1UL << page_size_log);
|
2013-05-07 16:18:13 -07:00
|
|
|
}
|
|
|
|
|
|
2008-07-23 21:27:43 -07:00
|
|
|
static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
|
2008-07-23 21:27:41 -07:00
|
|
|
{
|
2008-07-23 21:27:43 -07:00
|
|
|
return hstate_file(vma->vm_file);
|
2008-07-23 21:27:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned long huge_page_size(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return (unsigned long)PAGE_SIZE << h->order;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-06 14:38:53 -08:00
|
|
|
extern unsigned long vma_kernel_pagesize(struct vm_area_struct *vma);
|
|
|
|
|
|
2009-01-06 14:38:54 -08:00
|
|
|
extern unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
|
|
|
|
|
|
2008-07-23 21:27:41 -07:00
|
|
|
static inline unsigned long huge_page_mask(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return h->mask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned int huge_page_order(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return h->order;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned huge_page_shift(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return h->order + PAGE_SHIFT;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-04 16:07:08 -07:00
|
|
|
static inline bool hstate_is_gigantic(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return huge_page_order(h) >= MAX_ORDER;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-23 21:27:41 -07:00
|
|
|
static inline unsigned int pages_per_huge_page(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return 1 << h->order;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned int blocks_per_huge_page(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return huge_page_size(h) / 512;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include <asm/hugetlb.h>
|
|
|
|
|
|
2012-04-01 14:01:34 -04:00
|
|
|
#ifndef arch_make_huge_pte
|
|
|
|
|
static inline pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
|
|
|
|
|
struct page *page, int writable)
|
|
|
|
|
{
|
|
|
|
|
return entry;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-07-23 21:27:42 -07:00
|
|
|
static inline struct hstate *page_hstate(struct page *page)
|
|
|
|
|
{
|
2014-01-23 15:52:54 -08:00
|
|
|
VM_BUG_ON_PAGE(!PageHuge(page), page);
|
2019-09-23 15:34:25 -07:00
|
|
|
return size_to_hstate(page_size(page));
|
2008-07-23 21:27:42 -07:00
|
|
|
}
|
|
|
|
|
|
2010-10-06 21:45:00 +02:00
|
|
|
static inline unsigned hstate_index_to_shift(unsigned index)
|
|
|
|
|
{
|
|
|
|
|
return hstates[index].order + PAGE_SHIFT;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-31 16:42:00 -07:00
|
|
|
static inline int hstate_index(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return h - hstates;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-25 21:19:31 +08:00
|
|
|
pgoff_t __basepage_index(struct page *page);
|
|
|
|
|
|
|
|
|
|
/* Return page->index in PAGE_SIZE units */
|
|
|
|
|
static inline pgoff_t basepage_index(struct page *page)
|
|
|
|
|
{
|
|
|
|
|
if (!PageCompound(page))
|
|
|
|
|
return page->index;
|
|
|
|
|
|
|
|
|
|
return __basepage_index(page);
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-10 15:47:41 -07:00
|
|
|
extern int dissolve_free_huge_page(struct page *page);
|
2016-10-07 17:01:10 -07:00
|
|
|
extern int dissolve_free_huge_pages(unsigned long start_pfn,
|
|
|
|
|
unsigned long end_pfn);
|
2019-03-05 15:43:51 -08:00
|
|
|
|
2014-06-04 16:05:35 -07:00
|
|
|
#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
|
2019-03-05 15:43:51 -08:00
|
|
|
#ifndef arch_hugetlb_migration_supported
|
|
|
|
|
static inline bool arch_hugetlb_migration_supported(struct hstate *h)
|
|
|
|
|
{
|
2017-07-06 15:38:38 -07:00
|
|
|
if ((huge_page_shift(h) == PMD_SHIFT) ||
|
2019-03-05 15:43:48 -08:00
|
|
|
(huge_page_shift(h) == PUD_SHIFT) ||
|
|
|
|
|
(huge_page_shift(h) == PGDIR_SHIFT))
|
2017-07-06 15:38:38 -07:00
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
2019-03-05 15:43:51 -08:00
|
|
|
}
|
|
|
|
|
#endif
|
2014-06-04 16:05:35 -07:00
|
|
|
#else
|
2019-03-05 15:43:51 -08:00
|
|
|
static inline bool arch_hugetlb_migration_supported(struct hstate *h)
|
|
|
|
|
{
|
2016-05-20 16:58:01 -07:00
|
|
|
return false;
|
2019-03-05 15:43:51 -08:00
|
|
|
}
|
2014-06-04 16:05:35 -07:00
|
|
|
#endif
|
2019-03-05 15:43:51 -08:00
|
|
|
|
|
|
|
|
static inline bool hugepage_migration_supported(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return arch_hugetlb_migration_supported(h);
|
2013-09-11 14:22:11 -07:00
|
|
|
}
|
2013-09-11 14:22:09 -07:00
|
|
|
|
2019-03-05 15:43:44 -08:00
|
|
|
/*
|
|
|
|
|
* Movability check is different as compared to migration check.
|
|
|
|
|
* It determines whether or not a huge page should be placed on
|
|
|
|
|
* movable zone or not. Movability of any huge page should be
|
|
|
|
|
* required only if huge page size is supported for migration.
|
|
|
|
|
* There wont be any reason for the huge page to be movable if
|
|
|
|
|
* it is not migratable to start with. Also the size of the huge
|
|
|
|
|
* page should be large enough to be placed under a movable zone
|
|
|
|
|
* and still feasible enough to be migratable. Just the presence
|
|
|
|
|
* in movable zone does not make the migration feasible.
|
|
|
|
|
*
|
|
|
|
|
* So even though large huge page sizes like the gigantic ones
|
|
|
|
|
* are migratable they should not be movable because its not
|
|
|
|
|
* feasible to migrate them from movable zone.
|
|
|
|
|
*/
|
|
|
|
|
static inline bool hugepage_movable_supported(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
if (!hugepage_migration_supported(h))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (hstate_is_gigantic(h))
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-14 14:31:02 -08:00
|
|
|
static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
|
|
|
|
|
struct mm_struct *mm, pte_t *pte)
|
|
|
|
|
{
|
|
|
|
|
if (huge_page_size(h) == PMD_SIZE)
|
|
|
|
|
return pmd_lockptr(mm, (pmd_t *) pte);
|
|
|
|
|
VM_BUG_ON(huge_page_size(h) == PAGE_SIZE);
|
|
|
|
|
return &mm->page_table_lock;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-17 16:23:37 -07:00
|
|
|
#ifndef hugepages_supported
|
|
|
|
|
/*
|
|
|
|
|
* Some platform decide whether they support huge pages at boot
|
|
|
|
|
* time. Some of them, such as powerpc, set HPAGE_SHIFT to 0
|
|
|
|
|
* when there is no such support
|
|
|
|
|
*/
|
|
|
|
|
#define hugepages_supported() (HPAGE_SHIFT != 0)
|
|
|
|
|
#endif
|
2014-05-06 12:50:00 -07:00
|
|
|
|
2015-11-05 18:47:14 -08:00
|
|
|
void hugetlb_report_usage(struct seq_file *m, struct mm_struct *mm);
|
|
|
|
|
|
|
|
|
|
static inline void hugetlb_count_add(long l, struct mm_struct *mm)
|
|
|
|
|
{
|
|
|
|
|
atomic_long_add(l, &mm->hugetlb_usage);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void hugetlb_count_sub(long l, struct mm_struct *mm)
|
|
|
|
|
{
|
|
|
|
|
atomic_long_sub(l, &mm->hugetlb_usage);
|
|
|
|
|
}
|
2017-07-06 15:39:50 -07:00
|
|
|
|
|
|
|
|
#ifndef set_huge_swap_pte_at
|
|
|
|
|
static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr,
|
|
|
|
|
pte_t *ptep, pte_t pte, unsigned long sz)
|
|
|
|
|
{
|
|
|
|
|
set_huge_pte_at(mm, addr, ptep, pte);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2019-03-05 15:46:37 -08:00
|
|
|
|
|
|
|
|
#ifndef huge_ptep_modify_prot_start
|
|
|
|
|
#define huge_ptep_modify_prot_start huge_ptep_modify_prot_start
|
|
|
|
|
static inline pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma,
|
|
|
|
|
unsigned long addr, pte_t *ptep)
|
|
|
|
|
{
|
|
|
|
|
return huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef huge_ptep_modify_prot_commit
|
|
|
|
|
#define huge_ptep_modify_prot_commit huge_ptep_modify_prot_commit
|
|
|
|
|
static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
|
|
|
|
|
unsigned long addr, pte_t *ptep,
|
|
|
|
|
pte_t old_pte, pte_t pte)
|
|
|
|
|
{
|
|
|
|
|
set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-05-07 16:18:13 -07:00
|
|
|
#else /* CONFIG_HUGETLB_PAGE */
|
2008-07-23 21:27:41 -07:00
|
|
|
struct hstate {};
|
2019-07-11 20:54:40 -07:00
|
|
|
|
|
|
|
|
static inline struct page *alloc_huge_page(struct vm_area_struct *vma,
|
|
|
|
|
unsigned long addr,
|
|
|
|
|
int avoid_reserve)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct page *alloc_huge_page_node(struct hstate *h, int nid)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct page *
|
|
|
|
|
alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct page *alloc_huge_page_vma(struct hstate *h,
|
|
|
|
|
struct vm_area_struct *vma,
|
|
|
|
|
unsigned long address)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int __alloc_bootmem_huge_page(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct hstate *hstate_file(struct file *f)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct hstate *hstate_sizelog(int page_size_log)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct hstate *hstate_inode(struct inode *i)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline struct hstate *page_hstate(struct page *page)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned long huge_page_size(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return PAGE_SIZE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned long huge_page_mask(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return PAGE_MASK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
|
|
|
|
|
{
|
|
|
|
|
return PAGE_SIZE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
|
|
|
|
|
{
|
|
|
|
|
return PAGE_SIZE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned int huge_page_order(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline unsigned int huge_page_shift(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return PAGE_SHIFT;
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-06 15:38:38 -07:00
|
|
|
static inline bool hstate_is_gigantic(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2008-07-26 15:22:27 -07:00
|
|
|
static inline unsigned int pages_per_huge_page(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2017-07-10 15:47:41 -07:00
|
|
|
|
|
|
|
|
static inline unsigned hstate_index_to_shift(unsigned index)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int hstate_index(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2013-06-25 21:19:31 +08:00
|
|
|
|
|
|
|
|
static inline pgoff_t basepage_index(struct page *page)
|
|
|
|
|
{
|
|
|
|
|
return page->index;
|
|
|
|
|
}
|
2017-07-10 15:47:41 -07:00
|
|
|
|
|
|
|
|
static inline int dissolve_free_huge_page(struct page *page)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline int dissolve_free_huge_pages(unsigned long start_pfn,
|
|
|
|
|
unsigned long end_pfn)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool hugepage_migration_supported(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-11-14 14:31:02 -08:00
|
|
|
|
2019-03-05 15:43:44 -08:00
|
|
|
static inline bool hugepage_movable_supported(struct hstate *h)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-14 14:31:02 -08:00
|
|
|
static inline spinlock_t *huge_pte_lockptr(struct hstate *h,
|
|
|
|
|
struct mm_struct *mm, pte_t *pte)
|
|
|
|
|
{
|
|
|
|
|
return &mm->page_table_lock;
|
|
|
|
|
}
|
2015-11-05 18:47:14 -08:00
|
|
|
|
|
|
|
|
static inline void hugetlb_report_usage(struct seq_file *f, struct mm_struct *m)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void hugetlb_count_sub(long l, struct mm_struct *mm)
|
|
|
|
|
{
|
|
|
|
|
}
|
2017-07-06 15:39:50 -07:00
|
|
|
|
|
|
|
|
static inline void set_huge_swap_pte_at(struct mm_struct *mm, unsigned long addr,
|
|
|
|
|
pte_t *ptep, pte_t pte, unsigned long sz)
|
|
|
|
|
{
|
|
|
|
|
}
|
2013-05-07 16:18:13 -07:00
|
|
|
#endif /* CONFIG_HUGETLB_PAGE */
|
2008-07-23 21:27:41 -07:00
|
|
|
|
2013-11-14 14:31:02 -08:00
|
|
|
static inline spinlock_t *huge_pte_lock(struct hstate *h,
|
|
|
|
|
struct mm_struct *mm, pte_t *pte)
|
|
|
|
|
{
|
|
|
|
|
spinlock_t *ptl;
|
|
|
|
|
|
|
|
|
|
ptl = huge_pte_lockptr(h, mm, pte);
|
|
|
|
|
spin_lock(ptl);
|
|
|
|
|
return ptl;
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#endif /* _LINUX_HUGETLB_H */
|