Re: [PATCH 2/2] hugetlbfs: convert macros to static inline, fix sparse warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/12/19 1:13 PM, Joe Perches wrote:
> On Tue, 2019-11-12 at 11:45 -0800, Mike Kravetz wrote:
>> huge_pte_offset() produced a sparse warning due to an improper
>> return type when the kernel was built with !CONFIG_HUGETLB_PAGE.
>> Fix the bad type and also convert all the macros in this block
>> to static inline wrappers.  Two existing wrappers in this block
>> had lines in excess of 80 columns so clean those up as well.
>>
>> No functional change.
>>
>> Reported-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
>> Suggested-by: Jason Gunthorpe <jgg@xxxxxxxx>
>> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
>> ---
>>  include/linux/hugetlb.h | 137 +++++++++++++++++++++++++++++++++-------
>>  1 file changed, 115 insertions(+), 22 deletions(-)
>>
>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>> index 53fc34f930d0..ef412fe0be3d 100644
>> --- a/include/linux/hugetlb.h
>> +++ b/include/linux/hugetlb.h
>> @@ -164,38 +164,130 @@ static inline void adjust_range_if_pmd_sharing_possible(
>>  {
>>  }
>>  
>> -#define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n)	({ BUG(); 0; })
>> -#define follow_huge_addr(mm, addr, write)	ERR_PTR(-EINVAL)
>> -#define copy_hugetlb_page_range(src, dst, vma)	({ BUG(); 0; })
>> +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();
> 
> While this is not different from the original, perhaps this is
> also an opportunity to change the BUG()s to WARN()s.

Yes, I saw all those warnings from checkpatch.  I'll add this as a 'to do'.
There are a bunch of these in hugetlbfs code and headers.  I'd really to
take a closer look at all of these and try to do something more intelligent.

-- 
Mike Kravetz




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux