Re: [Lhms-devel] [PATCH 4/7] Direct Migration V5: migrate_pages() extension

Christoph Lameter
2005-11-30T17:55:20Z

On Thu, 1 Dec 2005, Kamezawa Hiroyuki wrote:

> Christoph Lameter wrote:
> > The current page migration functions in mempolicy.c do not migrate shmem
> > vmas to be safe. In the future we surely would like to support migration of
> > shmem. I'd be glad if you could make sure that this works.
> >
> Okay, shmem is not problem now.

So I could allow VM_SHM migration? Patch attached.

> remove_from_page_cache(page) sets page->mapping == NULL.

Correct. So shmem_writepage actually removes a page. Hmm...

> Even if page->mapping == NULL, page_mapping() can return &swapper_space if
> PageSwapCache()
> is true. (Note: a shmem page here is not page-cache, not anon, but swap-cache)
>
> I'm now considering to add a_ops->migrate_page() to shmem is sane way...
> But migration doesn't manage shmem, so this is just memory hot-remove's
> problem.

Do you think this patch would work? It allows migration of VM_SHM vmas and
switches from checking page->mapping to page_mapping() in
migrate_page_remove_references.

Index: linux-2.6.15-rc3-mm1/mm/mempolicy.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/mm/mempolicy.c 2005-11-30 09:53:31.000000000 -0800
+++ linux-2.6.15-rc3-mm1/mm/mempolicy.c 2005-11-30 09:53:32.000000000 -0800
@@ -294,7 +294,7 @@ static inline int check_pgd_range(struct
static inline int vma_migratable(struct vm_area_struct *vma)
{
if (vma->vm_flags & (
- VM_LOCKED|VM_IO|VM_RESERVED|VM_PFNMAP|VM_DENYWRITE|VM_SHM))
+ VM_LOCKED|VM_IO|VM_RESERVED|VM_PFNMAP|VM_DENYWRITE))
return 0;
return 1;
}
Index: linux-2.6.15-rc3-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.15-rc3-mm1.orig/mm/vmscan.c 2005-11-30 09:53:31.000000000 -0800
+++ linux-2.6.15-rc3-mm1/mm/vmscan.c 2005-11-30 09:53:41.000000000 -0800
@@ -742,7 +742,7 @@ int migrate_page_remove_references(struc
&mapping->page_tree,
page_index(page));

- if (!page->mapping ||
+ if (!page_mapping(page) ||
page_count(page) != nr_refs ||
*radix_pointer != page) {
write_unlock_irq(&mapping->tree_lock);