diff options
author | Lee Schermerhorn <Lee.Schermerhorn@hp.com> | 2006-04-22 05:35:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-22 12:19:52 -0400 |
commit | 304dbdb7a4fbb7f40a6ad5c5836fdd456c233c63 (patch) | |
tree | 2bdd71bb0ab19422362e9d3999f975ae27206965 /mm | |
parent | 3b5fd59fdd2e656dd4d10f2cedb41a7519b131b2 (diff) |
[PATCH] add migratepage address space op to shmem
Basic problem: pages of a shared memory segment can only be migrated once.
In 2.6.16 through 2.6.17-rc1, shared memory mappings do not have a
migratepage address space op. Therefore, migrate_pages() falls back to
default processing. In this path, it will try to pageout() dirty pages.
Once a shared memory page has been migrated it becomes dirty, so
migrate_pages() will try to page it out. However, because the page count
is 3 [cache + current + pte], pageout() will return PAGE_KEEP because
is_page_cache_freeable() returns false. This will abort all subsequent
migrations.
This patch adds a migratepage address space op to shared memory segments to
avoid taking the default path. We use the "migrate_page()" function
because it knows how to migrate dirty pages. This allows shared memory
segment pages to migrate, subject to other conditions such as # pte's
referencing the page [page_mapcount(page)], when requested.
I think this is safe. If we're migrating a shared memory page, then we
found the page via a page table, so it must be in memory.
Can be verified with memtoy and the shmem-mbind-test script, both
available at: http://free.linux.hp.com/~lts/Tools/
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index 37eaf42ed2c..4c5e68e4e9a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -46,6 +46,8 @@ | |||
46 | #include <linux/mempolicy.h> | 46 | #include <linux/mempolicy.h> |
47 | #include <linux/namei.h> | 47 | #include <linux/namei.h> |
48 | #include <linux/ctype.h> | 48 | #include <linux/ctype.h> |
49 | #include <linux/migrate.h> | ||
50 | |||
49 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
50 | #include <asm/div64.h> | 52 | #include <asm/div64.h> |
51 | #include <asm/pgtable.h> | 53 | #include <asm/pgtable.h> |
@@ -2173,6 +2175,7 @@ static struct address_space_operations shmem_aops = { | |||
2173 | .prepare_write = shmem_prepare_write, | 2175 | .prepare_write = shmem_prepare_write, |
2174 | .commit_write = simple_commit_write, | 2176 | .commit_write = simple_commit_write, |
2175 | #endif | 2177 | #endif |
2178 | .migratepage = migrate_page, | ||
2176 | }; | 2179 | }; |
2177 | 2180 | ||
2178 | static struct file_operations shmem_file_operations = { | 2181 | static struct file_operations shmem_file_operations = { |