All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: linux-kernel <linux-kernel@vger.kernel.org>,
	Linux Memory Management <linux-mm@kvack.org>
Cc: Hugh Dickins <hugh@veritas.com>, Badari Pulavarty <pbadari@us.ibm.com>
Subject: Re: [patch][rfc] 4/5: remap ZERO_PAGE mappings
Date: Thu, 23 Jun 2005 17:07:52 +1000	[thread overview]
Message-ID: <42BA5FC8.9020501@yahoo.com.au> (raw)
In-Reply-To: <42BA5FA8.7080905@yahoo.com.au>

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

4/5

[-- Attachment #2: mm-remap-ZERO_PAGE-mappings.patch --]
[-- Type: text/plain, Size: 1081 bytes --]

Remap ZERO_PAGE ptes when remapping memory. This is currently just an
optimisation for MIPS, which is the only architecture with multiple
zero pages - it now retains the mapping it needs for good cache performance,
and as well do_wp_page is now able to always correctly detect and
optimise zero page COW faults.

In future, this becomes required in order to always be able to detect
whether a pte points to a ZERO_PAGE using only the pte, vaddr pair.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/mm/mremap.c
===================================================================
--- linux-2.6.orig/mm/mremap.c
+++ linux-2.6/mm/mremap.c
@@ -141,6 +141,10 @@ move_one_page(struct vm_area_struct *vma
 			if (dst) {
 				pte_t pte;
 				pte = ptep_clear_flush(vma, old_addr, src);
+				/* ZERO_PAGE can be dependant on virtual addr */
+				if (pfn_valid(pte_pfn(pte)) &&
+					pte_page(pte) == ZERO_PAGE(old_addr))
+					pte = pte_wrprotect(mk_pte(ZERO_PAGE(new_addr), new_vma->vm_page_prot));
 				set_pte_at(mm, new_addr, dst, pte);
 			} else
 				error = -ENOMEM;

  reply	other threads:[~2005-06-23  8:19 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-23  7:05 [patch][rfc] 0/5: remove PageReserved Nick Piggin
2005-06-23  7:05 ` Nick Piggin
2005-06-23  7:06 ` [patch][rfc] 1/5: comment for mm/rmap.c Nick Piggin
2005-06-23  7:06   ` [patch][rfc] 2/5: micro optimisation " Nick Piggin
2005-06-23  7:07     ` [patch][rfc] 3/5: remove atomic bitop when freeing page Nick Piggin
2005-06-23  7:07       ` Nick Piggin [this message]
2005-06-23  7:08         ` [patch][rfc] 5/5: core remove PageReserved Nick Piggin
2005-06-23  9:51           ` William Lee Irwin III
2005-06-23  9:51             ` William Lee Irwin III
2005-06-23 10:32             ` Nick Piggin
2005-06-23 10:32               ` Nick Piggin
2005-06-23 22:08               ` William Lee Irwin III
2005-06-23 22:08                 ` William Lee Irwin III
2005-06-23 23:21                 ` Nick Piggin
2005-06-23 23:21                   ` Nick Piggin
2005-06-24  0:59                   ` William Lee Irwin III
2005-06-24  0:59                     ` William Lee Irwin III
2005-06-24  1:17                     ` Nick Piggin
2005-06-24  1:17                       ` Nick Piggin
2005-06-24  1:47                       ` Nick Piggin
2005-06-24  1:47                         ` Nick Piggin
2005-06-24  1:25                     ` Nick Piggin
2005-06-24  1:25                       ` Nick Piggin
2005-06-24  4:50             ` Andrew Morton
2005-06-24  4:50               ` Andrew Morton
2005-06-24  8:24               ` William Lee Irwin III
2005-06-24  8:24                 ` William Lee Irwin III
2005-06-26  8:41               ` Nick Piggin
2005-06-26  8:41                 ` Nick Piggin
2005-06-23  7:26     ` [patch][rfc] 2/5: micro optimisation for mm/rmap.c William Lee Irwin III
2005-06-23  7:26       ` William Lee Irwin III
2005-06-23  7:33       ` Nick Piggin

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=42BA5FC8.9020501@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pbadari@us.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.