linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-mm@kvack.org, mel@csn.ul.ie, y-goto@jp.fujitsu.com,
	hugh@veritas.com
Subject: Re: memory unplug v4 intro [1/6] migration without mm->sem
Date: Thu, 7 Jun 2007 23:44:38 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0706072344040.29301@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20070608150602.78f07b34.kamezawa.hiroyu@jp.fujitsu.com>

I think what Hugh meant is someething like this:

---
 mm/migrate.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Index: linux-2.6/mm/migrate.c
===================================================================
--- linux-2.6.orig/mm/migrate.c	2007-06-07 23:27:07.000000000 -0700
+++ linux-2.6/mm/migrate.c	2007-06-07 23:40:25.000000000 -0700
@@ -209,10 +209,6 @@ static void remove_file_migration_ptes(s
 	spin_unlock(&mapping->i_mmap_lock);
 }
 
-/*
- * Must hold mmap_sem lock on at least one of the vmas containing
- * the page so that the anon_vma cannot vanish.
- */
 static void remove_anon_migration_ptes(struct page *old, struct page *new)
 {
 	struct anon_vma *anon_vma;
@@ -612,6 +608,7 @@ static int unmap_and_move(new_page_t get
 	int rc = 0;
 	int *result = NULL;
 	struct page *newpage = get_new_page(page, private, &result);
+	struct vm_area_struct dummy_vma = { 0 };
 
 	if (!newpage)
 		return -ENOMEM;
@@ -634,6 +631,12 @@ static int unmap_and_move(new_page_t get
 	}
 
 	/*
+	 * Add dummy vma so that the vma cannot vanish under us
+	 */
+	if (PageAnon(page))
+		anon_vma_link(&dummy_vma);
+
+	/*
 	 * Establish migration ptes or remove ptes
 	 */
 	try_to_unmap(page, 1);
@@ -643,6 +646,9 @@ static int unmap_and_move(new_page_t get
 	if (rc)
 		remove_migration_ptes(page, page);
 
+	/* Remove dummy vma */
+	if (PageAnon(page))
+		anon_vma_unlink(&dummy_vma);
 unlock:
 	unlock_page(page);
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-06-08  6:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08  5:35 memory unplug v4 intro [0/6] KAMEZAWA Hiroyuki
2007-06-08  5:38 ` memory unplug v4 intro [1/6] migration without mm->sem KAMEZAWA Hiroyuki
2007-06-08  5:47   ` Christoph Lameter
2007-06-08  5:54     ` KAMEZAWA Hiroyuki
2007-06-08  5:57       ` Christoph Lameter
2007-06-08  6:06         ` KAMEZAWA Hiroyuki
2007-06-08  6:44           ` Christoph Lameter [this message]
2007-06-08  7:01             ` KAMEZAWA Hiroyuki
2007-06-08  7:21               ` Christoph Lameter
2007-06-08  7:25                 ` KAMEZAWA Hiroyuki
2007-06-08  5:39 ` memory unplug v4 [2/6] lru isolation race fix KAMEZAWA Hiroyuki
2007-06-08  5:52   ` Christoph Lameter
2007-06-08  5:58     ` KAMEZAWA Hiroyuki
2007-06-08  5:58       ` Christoph Lameter
2007-06-08  5:40 ` memory unplug v4 intro [3/6] walk memory resources KAMEZAWA Hiroyuki
2007-06-08  5:41 ` memory unplug v4 intro [4/6] page isolation KAMEZAWA Hiroyuki
2007-06-08 13:24   ` Mel Gorman
2007-06-08 13:59     ` KAMEZAWA Hiroyuki
2007-06-08  5:43 ` memory unplug v4 intro [5/6] page offlining KAMEZAWA Hiroyuki
2007-06-08  5:43 ` memory unplug v4 intro [6/6] ia64 interface KAMEZAWA Hiroyuki

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=Pine.LNX.4.64.0706072344040.29301@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=hugh@veritas.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=y-goto@jp.fujitsu.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