Re: [PATCH v2] mm: Change return type int to vm_fault_t for fault handlers

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

 



On Sun, Jun 03, 2018 at 01:34:07AM +0530, Souptick Joarder wrote:
> @@ -3570,9 +3571,8 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
>  			return 0;
>  		}
>  
> -		ret = (PTR_ERR(new_page) == -ENOMEM) ?
> -			VM_FAULT_OOM : VM_FAULT_SIGBUS;
> -		goto out_release_old;
> +		ret = vmf_error(PTR_ERR(new_page));
> +			goto out_release_old;
>  	}
>  
>  	/*

Something weird happened to the goto here?

> +static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
> +			struct vm_area_struct *vma,
> +			struct address_space *mapping, pgoff_t idx,
> +			unsigned long address, pte_t *ptep, unsigned int flags)
>  {
>  	struct hstate *h = hstate_vma(vma);
> -	int ret = VM_FAULT_SIGBUS;
> -	int anon_rmap = 0;
> +	vm_fault_t ret = VM_FAULT_SIGBUS;
> +	int anon_rmap = 0, err;
>  	unsigned long size;
>  	struct page *page;
>  	pte_t new_pte;
> @@ -3742,11 +3743,8 @@ static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma,
>  
>  		page = alloc_huge_page(vma, address, 0);
>  		if (IS_ERR(page)) {
> -			ret = PTR_ERR(page);
> -			if (ret == -ENOMEM)
> -				ret = VM_FAULT_OOM;
> -			else
> -				ret = VM_FAULT_SIGBUS;
> +			err = PTR_ERR(page);
> +			ret = vmf_error(err);
>  			goto out;
>  		}
>  		clear_huge_page(page, address, pages_per_huge_page(h));

Not sure why you bother with the 'int err' in this function when just
above you were happy to do

			ret = vmf_error(PTR_ERR(page));

With those fixed,

Reviewed-by: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux