summaryrefslogtreecommitdiffstats
path: root/include/linux/hugetlb.h
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2019-07-11 23:54:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 14:05:42 -0400
commit442a5a9a9295bfd9b0cffd0691ef8a6ce81db7c4 (patch)
treebce83bd43c6715f9c4c0fe6e6a61104908f14290 /include/linux/hugetlb.h
parent465fc3a9b3129722b0df395529b3894b0b90d2de (diff)
mm: make !CONFIG_HUGE_PAGE wrappers into static inlines
Instead of using defines, which loses type safety and provokes unused variable warnings from gcc, put the constants into static inlines. Link: http://lkml.kernel.org/r/20190522235102.GA15370@mellanox.com Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Suggested-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com> Cc: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/hugetlb.h')
-rw-r--r--include/linux/hugetlb.h102
1 files changed, 86 insertions, 16 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index edf476c8cfb9..f895a79c6f5c 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -608,22 +608,92 @@ static inline void huge_ptep_modify_prot_commit(struct vm_area_struct *vma,
608 608
609#else /* CONFIG_HUGETLB_PAGE */ 609#else /* CONFIG_HUGETLB_PAGE */
610struct hstate {}; 610struct hstate {};
611#define alloc_huge_page(v, a, r) NULL 611
612#define alloc_huge_page_node(h, nid) NULL 612static inline struct page *alloc_huge_page(struct vm_area_struct *vma,
613#define alloc_huge_page_nodemask(h, preferred_nid, nmask) NULL 613 unsigned long addr,
614#define alloc_huge_page_vma(h, vma, address) NULL 614 int avoid_reserve)
615#define alloc_bootmem_huge_page(h) NULL 615{
616#define hstate_file(f) NULL 616 return NULL;
617#define hstate_sizelog(s) NULL 617}
618#define hstate_vma(v) NULL 618
619#define hstate_inode(i) NULL 619static inline struct page *alloc_huge_page_node(struct hstate *h, int nid)
620#define page_hstate(page) NULL 620{
621#define huge_page_size(h) PAGE_SIZE 621 return NULL;
622#define huge_page_mask(h) PAGE_MASK 622}
623#define vma_kernel_pagesize(v) PAGE_SIZE 623
624#define vma_mmu_pagesize(v) PAGE_SIZE 624static inline struct page *
625#define huge_page_order(h) 0 625alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask)
626#define huge_page_shift(h) PAGE_SHIFT 626{
627 return NULL;
628}
629
630static inline struct page *alloc_huge_page_vma(struct hstate *h,
631 struct vm_area_struct *vma,
632 unsigned long address)
633{
634 return NULL;
635}
636
637static inline int __alloc_bootmem_huge_page(struct hstate *h)
638{
639 return 0;
640}
641
642static inline struct hstate *hstate_file(struct file *f)
643{
644 return NULL;
645}
646
647static inline struct hstate *hstate_sizelog(int page_size_log)
648{
649 return NULL;
650}
651
652static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
653{
654 return NULL;
655}
656
657static inline struct hstate *hstate_inode(struct inode *i)
658{
659 return NULL;
660}
661
662static inline struct hstate *page_hstate(struct page *page)
663{
664 return NULL;
665}
666
667static inline unsigned long huge_page_size(struct hstate *h)
668{
669 return PAGE_SIZE;
670}
671
672static inline unsigned long huge_page_mask(struct hstate *h)
673{
674 return PAGE_MASK;
675}
676
677static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma)
678{
679 return PAGE_SIZE;
680}
681
682static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
683{
684 return PAGE_SIZE;
685}
686
687static inline unsigned int huge_page_order(struct hstate *h)
688{
689 return 0;
690}
691
692static inline unsigned int huge_page_shift(struct hstate *h)
693{
694 return PAGE_SHIFT;
695}
696
627static inline bool hstate_is_gigantic(struct hstate *h) 697static inline bool hstate_is_gigantic(struct hstate *h)
628{ 698{
629 return false; 699 return false;