diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2019-07-11 23:54:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-12 14:05:42 -0400 |
commit | 442a5a9a9295bfd9b0cffd0691ef8a6ce81db7c4 (patch) | |
tree | bce83bd43c6715f9c4c0fe6e6a61104908f14290 /include/linux/hugetlb.h | |
parent | 465fc3a9b3129722b0df395529b3894b0b90d2de (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.h | 102 |
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 */ |
610 | struct hstate {}; | 610 | struct hstate {}; |
611 | #define alloc_huge_page(v, a, r) NULL | 611 | |
612 | #define alloc_huge_page_node(h, nid) NULL | 612 | static 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 | 619 | static 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 | 624 | static inline struct page * |
625 | #define huge_page_order(h) 0 | 625 | alloc_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 | |||
630 | static 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 | |||
637 | static inline int __alloc_bootmem_huge_page(struct hstate *h) | ||
638 | { | ||
639 | return 0; | ||
640 | } | ||
641 | |||
642 | static inline struct hstate *hstate_file(struct file *f) | ||
643 | { | ||
644 | return NULL; | ||
645 | } | ||
646 | |||
647 | static inline struct hstate *hstate_sizelog(int page_size_log) | ||
648 | { | ||
649 | return NULL; | ||
650 | } | ||
651 | |||
652 | static inline struct hstate *hstate_vma(struct vm_area_struct *vma) | ||
653 | { | ||
654 | return NULL; | ||
655 | } | ||
656 | |||
657 | static inline struct hstate *hstate_inode(struct inode *i) | ||
658 | { | ||
659 | return NULL; | ||
660 | } | ||
661 | |||
662 | static inline struct hstate *page_hstate(struct page *page) | ||
663 | { | ||
664 | return NULL; | ||
665 | } | ||
666 | |||
667 | static inline unsigned long huge_page_size(struct hstate *h) | ||
668 | { | ||
669 | return PAGE_SIZE; | ||
670 | } | ||
671 | |||
672 | static inline unsigned long huge_page_mask(struct hstate *h) | ||
673 | { | ||
674 | return PAGE_MASK; | ||
675 | } | ||
676 | |||
677 | static inline unsigned long vma_kernel_pagesize(struct vm_area_struct *vma) | ||
678 | { | ||
679 | return PAGE_SIZE; | ||
680 | } | ||
681 | |||
682 | static inline unsigned long vma_mmu_pagesize(struct vm_area_struct *vma) | ||
683 | { | ||
684 | return PAGE_SIZE; | ||
685 | } | ||
686 | |||
687 | static inline unsigned int huge_page_order(struct hstate *h) | ||
688 | { | ||
689 | return 0; | ||
690 | } | ||
691 | |||
692 | static inline unsigned int huge_page_shift(struct hstate *h) | ||
693 | { | ||
694 | return PAGE_SHIFT; | ||
695 | } | ||
696 | |||
627 | static inline bool hstate_is_gigantic(struct hstate *h) | 697 | static inline bool hstate_is_gigantic(struct hstate *h) |
628 | { | 698 | { |
629 | return false; | 699 | return false; |