* [PATCH 2.6.17-rc1-mm3] add migratepage address space op to shmem
@ 2006-04-20 16:00 Lee Schermerhorn
2006-04-20 16:22 ` Christoph Lameter
2006-04-20 23:46 ` Andrew Morton
0 siblings, 2 replies; 4+ messages in thread
From: Lee Schermerhorn @ 2006-04-20 16:00 UTC (permalink / raw)
To: linux-mm; +Cc: Andrew Morton, Christoph Lameter
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>
Index: linux-2.6.17-rc1-mm3/mm/shmem.c
===================================================================
--- linux-2.6.17-rc1-mm3.orig/mm/shmem.c 2006-04-19 17:29:09.000000000 -0400
+++ linux-2.6.17-rc1-mm3/mm/shmem.c 2006-04-19 17:29:36.000000000 -0400
@@ -46,6 +46,8 @@
#include <linux/mempolicy.h>
#include <linux/namei.h>
#include <linux/ctype.h>
+#include <linux/migrate.h>
+
#include <asm/uaccess.h>
#include <asm/div64.h>
#include <asm/pgtable.h>
@@ -2165,6 +2167,7 @@ static struct address_space_operations s
.prepare_write = shmem_prepare_write,
.commit_write = simple_commit_write,
#endif
+ .migratepage = migrate_page,
};
static struct file_operations shmem_file_operations = {
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6.17-rc1-mm3] add migratepage address space op to shmem
2006-04-20 16:00 [PATCH 2.6.17-rc1-mm3] add migratepage address space op to shmem Lee Schermerhorn
@ 2006-04-20 16:22 ` Christoph Lameter
2006-04-20 23:46 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2006-04-20 16:22 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, Lee Schermerhorn
On Thu, 20 Apr 2006, Lee Schermerhorn wrote:
> 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>
>
> Index: linux-2.6.17-rc1-mm3/mm/shmem.c
> ===================================================================
> --- linux-2.6.17-rc1-mm3.orig/mm/shmem.c 2006-04-19 17:29:09.000000000 -0400
> +++ linux-2.6.17-rc1-mm3/mm/shmem.c 2006-04-19 17:29:36.000000000 -0400
> @@ -46,6 +46,8 @@
> #include <linux/mempolicy.h>
> #include <linux/namei.h>
> #include <linux/ctype.h>
> +#include <linux/migrate.h>
> +
> #include <asm/uaccess.h>
> #include <asm/div64.h>
> #include <asm/pgtable.h>
> @@ -2165,6 +2167,7 @@ static struct address_space_operations s
> .prepare_write = shmem_prepare_write,
> .commit_write = simple_commit_write,
> #endif
> + .migratepage = migrate_page,
> };
>
> static struct file_operations shmem_file_operations = {
>
>
>
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6.17-rc1-mm3] add migratepage address space op to shmem
2006-04-20 16:00 [PATCH 2.6.17-rc1-mm3] add migratepage address space op to shmem Lee Schermerhorn
2006-04-20 16:22 ` Christoph Lameter
@ 2006-04-20 23:46 ` Andrew Morton
2006-04-20 23:51 ` Christoph Lameter
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2006-04-20 23:46 UTC (permalink / raw)
To: Lee Schermerhorn; +Cc: linux-mm, clameter
Lee Schermerhorn <Lee.Schermerhorn@hp.com> wrote:
>
> 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.
This sounds to me like a bugfix-for-2.6.17 rather than a "PATCH
2.6.17-rc1-mm3"?
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6.17-rc1-mm3] add migratepage address space op to shmem
2006-04-20 23:46 ` Andrew Morton
@ 2006-04-20 23:51 ` Christoph Lameter
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2006-04-20 23:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: Lee Schermerhorn, linux-mm
On Thu, 20 Apr 2006, Andrew Morton wrote:
> > 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.
>
> This sounds to me like a bugfix-for-2.6.17 rather than a "PATCH
> 2.6.17-rc1-mm3"?
Correct.
--
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>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-04-20 23:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-20 16:00 [PATCH 2.6.17-rc1-mm3] add migratepage address space op to shmem Lee Schermerhorn
2006-04-20 16:22 ` Christoph Lameter
2006-04-20 23:46 ` Andrew Morton
2006-04-20 23:51 ` Christoph Lameter
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).