From: Christoph Lameter <clameter@sgi.com>
To: Paul Menage <menage@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Hugh Dickins <hugh@veritas.com>,
linux-mm@kvack.org, akpm@osdl.org
Subject: Re: [RFC][PATCH 0/1] Node-based reclaim/migration
Date: Thu, 30 Nov 2006 15:41:48 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0611301540390.13297@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <6599ad830611301333v48f2da03g747c088ed3b4ad60@mail.gmail.com>
I think you initial suggestion of adding a counter to the anon_vma may
work. Here is a patch that may allow us to keep the anon_vma around
without holding mmap_sem. Seems to be simple.
Hugh?
Index: linux-2.6.19-rc6-mm2/include/linux/rmap.h
===================================================================
--- linux-2.6.19-rc6-mm2.orig/include/linux/rmap.h 2006-11-15 22:03:40.000000000 -0600
+++ linux-2.6.19-rc6-mm2/include/linux/rmap.h 2006-11-30 17:39:17.643728656 -0600
@@ -26,6 +26,7 @@
struct anon_vma {
spinlock_t lock; /* Serialize access to vma list */
struct list_head head; /* List of private "related" vmas */
+ int migration_count; /* # processes migrating pages */
};
#ifdef CONFIG_MMU
Index: linux-2.6.19-rc6-mm2/mm/migrate.c
===================================================================
--- linux-2.6.19-rc6-mm2.orig/mm/migrate.c 2006-11-29 18:37:17.797934398 -0600
+++ linux-2.6.19-rc6-mm2/mm/migrate.c 2006-11-30 17:39:48.429639786 -0600
@@ -218,6 +218,7 @@ static void remove_anon_migration_ptes(s
struct anon_vma *anon_vma;
struct vm_area_struct *vma;
unsigned long mapping;
+ int empty;
mapping = (unsigned long)new->mapping;
@@ -229,11 +230,15 @@ static void remove_anon_migration_ptes(s
*/
anon_vma = (struct anon_vma *) (mapping - PAGE_MAPPING_ANON);
spin_lock(&anon_vma->lock);
+ anon_vma->migration_count--;
list_for_each_entry(vma, &anon_vma->head, anon_vma_node)
remove_migration_pte(vma, old, new);
+ empty = list_empty(&anon_vma->head);
spin_unlock(&anon_vma->lock);
+ if (empty)
+ anon_vma_free(anon_vma);
}
/*
Index: linux-2.6.19-rc6-mm2/mm/rmap.c
===================================================================
--- linux-2.6.19-rc6-mm2.orig/mm/rmap.c 2006-11-15 22:03:40.000000000 -0600
+++ linux-2.6.19-rc6-mm2/mm/rmap.c 2006-11-30 17:39:17.795109159 -0600
@@ -151,7 +151,7 @@ void anon_vma_unlink(struct vm_area_stru
list_del(&vma->anon_vma_node);
/* We must garbage collect the anon_vma if it's empty */
- empty = list_empty(&anon_vma->head);
+ empty = list_empty(&anon_vma->head) && !anon_vma->migration_count;
spin_unlock(&anon_vma->lock);
if (empty)
@@ -787,6 +787,9 @@ static int try_to_unmap_anon(struct page
if (!anon_vma)
return ret;
+ if (migration)
+ anon_vma->migration_count++;
+
list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
ret = try_to_unmap_one(page, vma, migration);
if (ret == SWAP_FAIL || !page_mapped(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>
next prev parent reply other threads:[~2006-11-30 23:41 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-29 3:06 menage
2006-11-29 3:06 ` [RFC][PATCH 1/1] Expose per-node reclaim and migration to userspace menage
2006-11-29 6:07 ` Nick Piggin
2006-11-29 21:57 ` Paul Menage
2006-11-30 4:13 ` Christoph Lameter
2006-11-30 4:18 ` Paul Menage
2006-11-30 7:38 ` Nick Piggin
2006-11-30 7:57 ` Paul Menage
2006-11-30 8:26 ` Nick Piggin
2006-11-30 8:39 ` Paul Menage
2006-11-30 8:55 ` Nick Piggin
2006-11-30 9:06 ` Paul Menage
2006-11-30 9:21 ` Nick Piggin
2006-11-30 9:45 ` Paul Menage
2006-11-30 10:15 ` Nick Piggin
2006-11-30 10:40 ` Paul Menage
2006-11-30 11:04 ` Nick Piggin
2006-11-30 11:23 ` Paul Menage
2006-11-30 11:35 ` Nick Piggin
2006-11-30 0:18 ` KAMEZAWA Hiroyuki
2006-11-30 0:25 ` Paul Menage
2006-11-30 0:38 ` KAMEZAWA Hiroyuki
2006-11-30 4:15 ` Christoph Lameter
2006-11-30 4:10 ` Christoph Lameter
2006-11-30 0:31 ` [RFC][PATCH 0/1] Node-based reclaim/migration KAMEZAWA Hiroyuki
2006-11-30 0:31 ` Paul Menage
2006-11-30 4:11 ` KAMEZAWA Hiroyuki
2006-11-30 4:17 ` Christoph Lameter
2006-11-30 10:45 ` Paul Menage
2006-11-30 11:12 ` KAMEZAWA Hiroyuki
2006-11-30 11:25 ` Paul Menage
2006-11-30 12:18 ` KAMEZAWA Hiroyuki
2006-11-30 18:28 ` Christoph Lameter
2006-11-30 18:35 ` Paul Menage
2006-11-30 18:39 ` Christoph Lameter
2006-11-30 19:09 ` Paul Menage
2006-11-30 19:42 ` Christoph Lameter
2006-11-30 19:53 ` Paul Menage
2006-11-30 20:00 ` Christoph Lameter
2006-11-30 20:07 ` Paul Menage
2006-11-30 20:15 ` Christoph Lameter
2006-11-30 21:33 ` Paul Menage
2006-11-30 23:41 ` Christoph Lameter [this message]
2006-11-30 23:48 ` Paul Menage
2006-12-01 2:23 ` Christoph Lameter
2006-12-01 19:32 ` Paul Menage
2006-12-01 19:56 ` Christoph Lameter
2006-12-01 2:44 ` KAMEZAWA Hiroyuki
2006-12-01 2:43 ` Christoph Lameter
2006-12-01 2:59 ` KAMEZAWA Hiroyuki
2006-12-01 2:44 ` Christoph Lameter
2006-12-01 3:10 ` KAMEZAWA Hiroyuki
2006-12-01 5:28 ` Christoph Lameter
2006-11-30 4:04 ` Christoph Lameter
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.0611301540390.13297@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=menage@google.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