+ preserve-write-permissions-in-migration-entries.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     Preserve write permissions in migration entries

has been added to the -mm tree.  Its filename is

     preserve-write-permissions-in-migration-entries.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this


From: Christoph Lameter <clameter@xxxxxxx>

Implement the preservation of the write permissions.  The preservation of
write permission avoids unnecessary COW operations following page
migration.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/linux/swap.h    |    5 +++--
 include/linux/swapops.h |   13 ++++++++++---
 mm/migrate.c            |    5 ++++-
 mm/rmap.c               |    2 +-
 4 files changed, 18 insertions(+), 7 deletions(-)

diff -puN include/linux/swap.h~preserve-write-permissions-in-migration-entries include/linux/swap.h
--- devel/include/linux/swap.h~preserve-write-permissions-in-migration-entries	2006-04-14 22:03:19.000000000 -0700
+++ devel-akpm/include/linux/swap.h	2006-04-14 22:03:19.000000000 -0700
@@ -33,8 +33,9 @@ static inline int current_is_kswapd(void
 #define MAX_SWAPFILES		(1 << MAX_SWAPFILES_SHIFT)
 #else
 /* Use last entry for page migration swap entries */
-#define MAX_SWAPFILES		((1 << MAX_SWAPFILES_SHIFT)-1)
-#define SWP_TYPE_MIGRATION	MAX_SWAPFILES
+#define MAX_SWAPFILES		((1 << MAX_SWAPFILES_SHIFT)-2)
+#define SWP_MIGRATION_READ	MAX_SWAPFILES
+#define SWP_MIGRATION_WRITE	(MAX_SWAPFILES + 1)
 #endif
 
 /*
diff -puN include/linux/swapops.h~preserve-write-permissions-in-migration-entries include/linux/swapops.h
--- devel/include/linux/swapops.h~preserve-write-permissions-in-migration-entries	2006-04-14 22:03:19.000000000 -0700
+++ devel-akpm/include/linux/swapops.h	2006-04-14 22:03:19.000000000 -0700
@@ -69,15 +69,22 @@ static inline pte_t swp_entry_to_pte(swp
 }
 
 #ifdef CONFIG_MIGRATION
-static inline swp_entry_t make_migration_entry(struct page *page)
+static inline swp_entry_t make_migration_entry(struct page *page, int write)
 {
 	BUG_ON(!PageLocked(page));
-	return swp_entry(SWP_TYPE_MIGRATION, page_to_pfn(page));
+	return swp_entry(write ? SWP_MIGRATION_WRITE : SWP_MIGRATION_READ,
+			 page_to_pfn(page));
 }
 
 static inline int is_migration_entry(swp_entry_t entry)
 {
-	return unlikely(swp_type(entry) == SWP_TYPE_MIGRATION);
+	return unlikely(swp_type(entry) == SWP_MIGRATION_READ ||
+			swp_type(entry) == SWP_MIGRATION_WRITE);
+}
+
+static inline int is_write_migration_entry(swp_entry_t entry)
+{
+	return swp_type(entry) == SWP_MIGRATION_WRITE;
 }
 
 static inline struct page *migration_entry_to_page(swp_entry_t entry)
diff -puN mm/migrate.c~preserve-write-permissions-in-migration-entries mm/migrate.c
--- devel/mm/migrate.c~preserve-write-permissions-in-migration-entries	2006-04-14 22:03:19.000000000 -0700
+++ devel-akpm/mm/migrate.c	2006-04-14 22:03:19.000000000 -0700
@@ -167,7 +167,10 @@ static void remove_migration_pte(struct 
 
 	inc_mm_counter(mm, anon_rss);
 	get_page(new);
-	set_pte_at(mm, addr, ptep, pte_mkold(mk_pte(new, vma->vm_page_prot)));
+	pte = pte_mkold(mk_pte(new, vma->vm_page_prot));
+	if (is_write_migration_entry(entry))
+		pte = pte_mkwrite(pte);
+	set_pte_at(mm, addr, ptep, pte);
 	page_add_anon_rmap(new, vma, addr);
 out:
 	pte_unmap_unlock(pte, ptl);
diff -puN mm/rmap.c~preserve-write-permissions-in-migration-entries mm/rmap.c
--- devel/mm/rmap.c~preserve-write-permissions-in-migration-entries	2006-04-14 22:03:19.000000000 -0700
+++ devel-akpm/mm/rmap.c	2006-04-14 22:03:19.000000000 -0700
@@ -602,7 +602,7 @@ static int try_to_unmap_one(struct page 
 			 * pte is removed and then restart fault handling.
 			 */
 			BUG_ON(!migration);
-			entry = make_migration_entry(page);
+			entry = make_migration_entry(page, pte_write(pteval));
 		}
 		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
 		BUG_ON(pte_file(*pte));
_

Patches currently in -mm which might be from clameter@xxxxxxx are

origin.patch
page-migration-make-do_swap_page-redo-the-fault.patch
slab-extract-cache_free_alien-from-__cache_free.patch
migration-remove-unnecessary-pageswapcache-checks.patch
migration-remove-unnecessary-pageswapcache-checks-fix.patch
swapless-v2-try_to_unmap-rename-ignrefs-to-migration.patch
swapless-v2-add-migration-swap-entries.patch
swapless-v2-add-migration-swap-entries-fix.patch
swapless-v2-make-try_to_unmap-create-migration-entries.patch
swapless-v2-rip-out-swap-portion-of-old-migration-code.patch
swapless-v2-revise-main-migration-logic.patch
preserve-write-permissions-in-migration-entries.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux