mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Mehnert <Frank.Mehnert@Sun.COM>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: PFs on pages pinned with get_user_pages()
Date: Thu, 29 Jan 2009 14:08:02 +0100	[thread overview]
Message-ID: <200901291408.02454.frank.mehnert@sun.com> (raw)
In-Reply-To: <1233232094.4495.45.camel@laptop>

[-- Attachment #1: Type: text/plain, Size: 1658 bytes --]

Peter,

On Thursday 29 January 2009, Peter Zijlstra wrote:
> On Thu, 2009-01-29 at 09:05 +0100, Frank Mehnert wrote:
> > please could someone explain me under which circumstances a pagefault,
> > either generated from kernel code or from userland code, can occur on
> > pages which are pinned with get_user_pages()?
> >
> > So far my understanding was that this can _never_ happen but I seems to
> > be wrong. Under high memory pressure I get PFs on such pages raised from
> > kernel code and the PFs are handled by do_swap_page(). When this happens,
> > page_count is 3 but page_mapped() returns false.
>
> Under memory pressure the page reclaim will first unmap the physical
> page from the virtual address range, and then try to free it.

Which means the page table entry is removed but the physical page
is not swapped out, right?

> Obviously the freeing bit fails if you hold a reference to it, but the
> unmap will work.

Right.

> After that, userspace will have to (minor) fault the stuff back in.

So do_swap_page does only 'restore' the page table entry, no further
reading from the swapfile is necessary?

> Also, that same page-reclaim, or pdflush might decide to write out dirty
> data, which will also result in (minor) faults when userspace will
> re-dirty the pages.
>
> Having a page reference will only avoid the physical page from getting
> removed from its current mapping (and thereby also pins the mapping).

Question: Is it possible to prevent these minor page faults at all?

Thank you very much for your answer!

Frank
-- 
Dr.-Ing. Frank Mehnert    Sun Microsystems    http://www.sun.com/

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2009-01-29 13:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29  8:05 Frank Mehnert
2009-01-29 12:28 ` Peter Zijlstra
2009-01-29 13:08   ` Frank Mehnert [this message]
2009-01-29 13:43     ` Peter Zijlstra
2009-01-29 14:02       ` Frank Mehnert
2009-01-29 14:20         ` Peter Zijlstra
2009-01-29 14:41           ` Frank Mehnert
2009-01-29 14:52             ` Peter Zijlstra
2009-01-29 16:03               ` Frank Mehnert
2009-01-29 16:11                 ` Peter Zijlstra
2009-01-30 10:34                   ` Frank Mehnert
2009-01-30 10:45                     ` Peter Zijlstra
2009-01-29 14:56             ` [PATCH] x86: add might_sleep() to do_page_fault() Peter Zijlstra
2009-01-29 14:59               ` Ingo Molnar
2009-01-29 15:02                 ` [PATCH v2] " Peter Zijlstra
2009-01-29 15:03                   ` Ingo Molnar

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=200901291408.02454.frank.mehnert@sun.com \
    --to=frank.mehnert@sun.com \
    --cc=linux-kernel@vger.kernel.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

Powered by JetHome