From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 17 Apr 2006 17:27:48 -0700 (PDT) From: Christoph Lameter Subject: Re: [PATCH 5/5] Swapless V2: Revise main migration logic In-Reply-To: <20060418090439.3e2f0df4.kamezawa.hiroyu@jp.fujitsu.com> Message-ID: References: <20060413235406.15398.42233.sendpatchset@schroedinger.engr.sgi.com> <20060413235432.15398.23912.sendpatchset@schroedinger.engr.sgi.com> <20060414101959.d59ac82d.kamezawa.hiroyu@jp.fujitsu.com> <20060414113455.15fd5162.kamezawa.hiroyu@jp.fujitsu.com> <20060415090639.dde469e8.kamezawa.hiroyu@jp.fujitsu.com> <20060417091830.bca60006.kamezawa.hiroyu@jp.fujitsu.com> <20060418090439.3e2f0df4.kamezawa.hiroyu@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: KAMEZAWA Hiroyuki Cc: akpm@osdl.org, hugh@veritas.com, linux-kernel@vger.kernel.org, lee.schermerhorn@hp.com, linux-mm@kvack.org, taka@valinux.co.jp, marcelo.tosatti@cyclades.com List-ID: On Tue, 18 Apr 2006, KAMEZAWA Hiroyuki wrote: > Then, > > if (is_migration_entry(entry)) { > change_to_read_migration_entry(entry); > copy_entry(entry); > } > > is sane. Hmmm... Looks like I need to do the patch. Is the following okay? This will also only work on cow mappings. Read/Write migration entries: Implement correct behavior in copy_one_pte Migration entries with write permission must become SWP_MIGRATION_READ entries if a COW mapping is processed. The migration entries from which the copy is being made must also become SWP_MIGRATION_READ. This mimicks the copying of pte for an anonymous page. Signed-off-by: KAMEZAWA Hiroyuki Signed-off-by: Christoph Lameter Index: linux-2.6.17-rc1-mm2/mm/memory.c =================================================================== --- linux-2.6.17-rc1-mm2.orig/mm/memory.c 2006-04-17 16:23:50.000000000 -0700 +++ linux-2.6.17-rc1-mm2/mm/memory.c 2006-04-17 17:25:50.000000000 -0700 @@ -434,7 +434,9 @@ copy_one_pte(struct mm_struct *dst_mm, s /* pte contains position in swap or file, so copy. */ if (unlikely(!pte_present(pte))) { if (!pte_file(pte)) { - swap_duplicate(pte_to_swp_entry(pte)); + swp_entry_t entry = pte_to_swp_entry(pte); + + swap_duplicate(entry); /* make sure dst_mm is on swapoff's mmlist. */ if (unlikely(list_empty(&dst_mm->mmlist))) { spin_lock(&mmlist_lock); @@ -443,6 +445,19 @@ copy_one_pte(struct mm_struct *dst_mm, s &src_mm->mmlist); spin_unlock(&mmlist_lock); } + if (is_migration_entry(entry) && + is_cow_mapping(vm_flags)) { + page = migration_entry_to_page(entry); + + /* + * COW mappings require pages in both parent + * and child to be set to read. + */ + entry = make_migration_entry(page, + ` SWP_MIGRATION_READ); + pte = swp_entry_to_pte(entry); + set_pte_at(src_mm, addr, src_pte, pte); + } } goto out_set_pte; } -- 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: email@kvack.org