Hmmm... Good ideas. I think it could be much simpler like the following
patch.
However, the problem here is how to know that we really took the anon_vma
lock and what to do about a page being unmmapped while migrating. This
could cause the anon_vma not to be unlocked.
I guess we would need to have try_to_unmap return some state information.
I also toyed around with writing an "install_migration_ptes" function
which would be called only for anonymous pages and would reduce the
changes to try_to_unmap(). However, that also got too complicated.
Index: linux-2.6.17-rc1-mm2/mm/migrate.c
===================================================================
--- linux-2.6.17-rc1-mm2.orig/mm/migrate.c 2006-04-17 17:21:08.000000000 -0700
+++ linux-2.6.17-rc1-mm2/mm/migrate.c 2006-04-17 23:53:32.000000000 -0700
@@ -236,7 +233,6 @@ static void remove_migration_ptes(struct
* We hold the mmap_sem lock. So no need to call page_lock_anon_vma.
*/
anon_vma = (struct anon_vma *) (mapping - PAGE_MAPPING_ANON);
- spin_lock(&anon_vma->lock);
list_for_each_entry(vma, &anon_vma->head, anon_vma_node)
remove_migration_pte(vma, page_address_in_vma(new, vma),
Index: linux-2.6.17-rc1-mm2/mm/rmap.c
===================================================================
--- linux-2.6.17-rc1-mm2.orig/mm/rmap.c 2006-04-17 17:21:08.000000000 -0700
+++ linux-2.6.17-rc1-mm2/mm/rmap.c 2006-04-17 23:53:39.000000000 -0700
@@ -723,7 +723,8 @@ static int try_to_unmap_anon(struct page
if (ret == SWAP_FAIL || !page_mapped(page))
break;
}
- spin_unlock(&anon_vma->lock);
+ if (!migration)
+ spin_unlock(&anon_vma->lock);
return ret;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]