diff options
author | Souptick Joarder <jrdr.linux@gmail.com> | 2019-03-28 23:43:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-29 13:01:37 -0400 |
commit | a953e7721fa9999fd628885ed451e16641a23d1e (patch) | |
tree | 16645ac478f842560d9d3a0017f37aa0c3a89b87 | |
parent | 0a352554da69b02f75ca3389c885c741f1f63235 (diff) |
include/linux/hugetlb.h: convert to use vm_fault_t
kbuild produces the below warning:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5453a3df2a5eb49bc24615d4cf0d66b2aae05e5f
commit 3d3539018d2c ("mm: create the new vm_fault_t type")
reproduce:
# apt-get install sparse
git checkout 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
>> mm/memory.c:3968:21: sparse: incorrect type in assignment (different
>> base types) @@ expected restricted vm_fault_t [usertype] ret @@
>> got e] ret @@
mm/memory.c:3968:21: expected restricted vm_fault_t [usertype] ret
mm/memory.c:3968:21: got int
This patch converts to return vm_fault_t type for hugetlb_fault() when
CONFIG_HUGETLB_PAGE=n.
Regarding the sparse warning, Luc said:
: This is the expected behaviour. The constant 0 is magic regarding bitwise
: types but ({ ...; 0; }) is not, it is just an ordinary expression of type
: 'int'.
:
: So, IMHO, Souptick's patch is the right thing to do.
Link: http://lkml.kernel.org/r/20190318162604.GA31553@jordon-HP-15-Notebook-PC
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/hugetlb.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index ea35263eb76b..11943b60f208 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -203,7 +203,6 @@ static inline void hugetlb_show_meminfo(void) | |||
203 | #define pud_huge(x) 0 | 203 | #define pud_huge(x) 0 |
204 | #define is_hugepage_only_range(mm, addr, len) 0 | 204 | #define is_hugepage_only_range(mm, addr, len) 0 |
205 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) | 205 | #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) |
206 | #define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) | ||
207 | #define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \ | 206 | #define hugetlb_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \ |
208 | src_addr, pagep) ({ BUG(); 0; }) | 207 | src_addr, pagep) ({ BUG(); 0; }) |
209 | #define huge_pte_offset(mm, address, sz) 0 | 208 | #define huge_pte_offset(mm, address, sz) 0 |
@@ -234,6 +233,13 @@ static inline void __unmap_hugepage_range(struct mmu_gather *tlb, | |||
234 | { | 233 | { |
235 | BUG(); | 234 | BUG(); |
236 | } | 235 | } |
236 | static inline vm_fault_t hugetlb_fault(struct mm_struct *mm, | ||
237 | struct vm_area_struct *vma, unsigned long address, | ||
238 | unsigned int flags) | ||
239 | { | ||
240 | BUG(); | ||
241 | return 0; | ||
242 | } | ||
237 | 243 | ||
238 | #endif /* !CONFIG_HUGETLB_PAGE */ | 244 | #endif /* !CONFIG_HUGETLB_PAGE */ |
239 | /* | 245 | /* |