public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Jes Sorensen <jes@sgi.com>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, Hugh Dickins <hugh@veritas.com>,
	bjorn_helgaas@hp.com, cotte@de.ibm.com
Subject: Re: [patch] do_no_pfn handler
Date: Mon, 03 Apr 2006 21:46:20 +1000	[thread overview]
Message-ID: <44310B0C.3070203@yahoo.com.au> (raw)
In-Reply-To: <yq0k6a6uc7i.fsf@jaguar.mkp.net>

Jes Sorensen wrote:
> +static int do_no_pfn(struct mm_struct *mm, struct vm_area_struct *vma,
> +		     unsigned long address, pte_t *page_table, pmd_t *pmd,
> +		     int write_access)
> +{
> +	spinlock_t *ptl;
> +	pte_t entry;
> +	long pfn;
> +	int ret = VM_FAULT_MINOR;
> +
> +	pte_unmap(page_table);
> +	BUG_ON(!(vma->vm_flags & VM_PFNMAP));
> +
> +	pfn = vma->vm_ops->nopfn(vma, address & PAGE_MASK, &ret);
> +	if (pfn == -ENOMEM)
> +		return VM_FAULT_OOM;
> +	if (pfn == -EFAULT)
> +		return VM_FAULT_SIGBUS;
> +	if (pfn < 0)
> +		return VM_FAULT_SIGBUS;
> +
> +	page_table = pte_offset_map_lock(mm, pmd, address, &ptl);
> +
> +	entry = pfn_pte(pfn, vma->vm_page_prot);
> +	if (write_access)
> +		entry = maybe_mkwrite(pte_mkdirty(entry), vma);
> +	set_pte_at(mm, address, page_table, entry);
> +

Should you recheck to make sure nobody else faulted this in
before it was relocked? Doesn't seem to matter in this case,
but it would be more consistent with the other fault handlers.

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2006-04-03 14:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-03 11:32 [patch] do_no_pfn handler Jes Sorensen
2006-04-03 11:46 ` Nick Piggin [this message]
2006-04-03 14:49   ` Jes Sorensen
2006-04-04 10:58 ` Jes Sorensen
2006-04-04 11:05   ` Nick Piggin
2006-04-05  9:34     ` Jes Sorensen
2006-04-19 14:10     ` [patch - repost] " Jes Sorensen
2006-04-21 10:41       ` Nick Piggin
2006-04-24  7:55         ` Jes Sorensen
2006-04-11 14:29 ` [patch] " Jes Sorensen
2006-04-11 15:10   ` Linus Torvalds
2006-04-11 15:26     ` Carsten Otte
2006-04-11 15:35       ` Linus Torvalds
2006-04-11 20:03         ` Carsten Otte
2006-04-11 20:30           ` Linus Torvalds
2006-04-11 20:53             ` Carsten Otte
2006-04-12  9:09     ` Jes Sorensen
2006-04-12  9:16       ` Carsten Otte

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=44310B0C.3070203@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=akpm@osdl.org \
    --cc=bjorn_helgaas@hp.com \
    --cc=cotte@de.ibm.com \
    --cc=hugh@veritas.com \
    --cc=jes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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