linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-arm-kernel@lists.infradead.org,
	Nicolas Pitre <nico@fluxnic.net>,
	moussaba@micron.com, David Rientjes <rientjes@google.com>,
	Hugh Dickins <hughd@google.com>
Subject: Re: [RFC PATCH] proc: clear_refs: do not clear reserved pages
Date: Fri, 13 Jan 2012 14:43:28 -0800	[thread overview]
Message-ID: <20120113144328.564cb50e.akpm@linux-foundation.org> (raw)
In-Reply-To: <20120113153556.GY1068@n2100.arm.linux.org.uk>

On Fri, 13 Jan 2012 15:35:56 +0000
Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:

> On Fri, Jan 13, 2012 at 03:13:07PM +0000, Will Deacon wrote:
> > /proc/pid/clear_refs is used to clear the Referenced and YOUNG bits for
> > pages and corresponding page table entries of the task with PID pid,
> > which includes any special mappings inserted into the page tables in
> > order to provide things like vDSOs and user helper functions.
> > 
> > On ARM this causes a problem because the vectors page is mapped as a
> > global mapping and since ec706dab ("ARM: add a vma entry for the user
> > accessible vector page"), a VMA is also inserted into each task for this
> > page to aid unwinding through signals and syscall restarts. Since the
> > vectors page is required for handling faults, clearing the YOUNG bit
> > (and subsequently writing a faulting pte) means that we lose the vectors
> > page *globally* and cannot fault it back in. This results in a system
> > deadlock on the next exception.
> > 
> > This patch avoids clearing the aforementioned bits for reserved pages,
> > therefore leaving the vectors page intact on ARM. Since reserved pages
> > are not candidates for swap, this change should not have any impact on
> > the usefulness of clear_refs.
> 
> Having just looked at mm/swapfile.c, what ensures that we don't try to swap
> the vectors page out?

Scanning and swapout access the page via the vm's page LRU lists. 
These magical pages shouldn't be on the LRU, so the VM won't pester
them.  If those pages did get added to the LRU somwhoe then yes,
there's a problem.

> I thought that VM_IO or VM_RESERVED once guaranteed that the vma wouldn't
> be scanned, but I don't see anything in there which tests these flags.
> As a result, it seems to me that the original patch is wrong, and we need
> to keep the vectors page completely out of the vma list to prevent it
> ever being made old.
> 
> Maybe the MM gurus can comment?

The MM guru is Hugh.

  reply	other threads:[~2012-01-13 22:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13 15:13 [RFC PATCH] proc: clear_refs: do not clear reserved pages Will Deacon
2012-01-13 15:35 ` Russell King - ARM Linux
2012-01-13 22:43   ` Andrew Morton [this message]
2012-01-13 22:55 ` Nicolas Pitre
2012-01-14 17:36   ` Hugh Dickins
2012-01-15 15:07     ` Will Deacon
2012-01-16  4:19       ` Nicolas Pitre
2012-01-16 10:06         ` Will Deacon

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=20120113144328.564cb50e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@arm.linux.org.uk \
    --cc=moussaba@micron.com \
    --cc=nico@fluxnic.net \
    --cc=rientjes@google.com \
    --cc=will.deacon@arm.com \
    /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).