linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: viro@zeniv.linux.org.uk, hughd@google.com,
	akpm@linux-foundation.org, mhocko@suse.com,
	ross.zwisler@linux.intel.com, zi.yan@cs.rutgers.edu,
	kirill.shutemov@linux.intel.com, dan.j.williams@intel.com,
	gregkh@linuxfoundation.org, mark.rutland@arm.com,
	riel@redhat.com, pasha.tatashin@oracle.com, jschoenh@amazon.de,
	kstewart@linuxfoundation.org, rientjes@google.com,
	tglx@linutronix.de, peterz@infradead.org, mgorman@suse.de,
	yang.s@alibaba-inc.com, minchan@kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: Change return type int to vm_fault_t for fault handlers
Date: Sat, 2 Jun 2018 15:01:36 -0700	[thread overview]
Message-ID: <20180602220136.GA14810@bombadil.infradead.org> (raw)
In-Reply-To: <20180602200407.GA15200@jordon-HP-15-Notebook-PC>

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@microsoft.com>

  reply	other threads:[~2018-06-02 22:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02 20:04 [PATCH v2] mm: Change return type int to vm_fault_t for fault handlers Souptick Joarder
2018-06-02 22:01 ` Matthew Wilcox [this message]
2018-06-04  4:37   ` Souptick Joarder
2018-06-04 13:49     ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180602220136.GA14810@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hughd@google.com \
    --cc=jrdr.linux@gmail.com \
    --cc=jschoenh@amazon.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mark.rutland@arm.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=pasha.tatashin@oracle.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=ross.zwisler@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yang.s@alibaba-inc.com \
    --cc=zi.yan@cs.rutgers.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).