Index: linux-2.6.17-rc1-mm2/mm/migrate.c =================================================================== --- linux-2.6.17-rc1-mm2.orig/mm/migrate.c 2006-04-14 14:33:38.000000000 -0700 +++ linux-2.6.17-rc1-mm2/mm/migrate.c 2006-04-14 14:36:21.000000000 -0700 @@ -190,9 +190,12 @@ void migration_entry_wait(swp_entry_t en struct anon_vma *anon_vma; pte_t pte; + printk(KERN_ERR "migration_entry_wait: page=%p\n", page); if (!mapping || - (mapping & PAGE_MAPPING_ANON) == 0) + (mapping & PAGE_MAPPING_ANON) == 0) { + printk(KERN_ERR "No anon mapping\n"); return; + } /* * We hold the mmap_sem lock. */ @@ -208,6 +211,7 @@ void migration_entry_wait(swp_entry_t en pte = *ptep; if (pte_present(pte) || pte_none(pte) || pte_file(pte)) { spin_unlock(&anon_vma->lock); + printk(KERN_ERR "pte not migration\n"); return; } entry = pte_to_swp_entry(pte); @@ -215,6 +219,7 @@ void migration_entry_wait(swp_entry_t en migration_entry_to_page(entry) != page) { /* Migration entry is gone */ spin_unlock(&anon_vma->lock); + printk(KERN_ERR "swap entry mismatch\n"); return; } /* Pages with migration entries must be locked */ @@ -284,8 +289,11 @@ int migrate_page_remove_references(struc * the page. */ if (!page->mapping || - page_mapcount(page) + nr_refs != page_count(page)) + page_mapcount(page) + nr_refs != page_count(page)) { + printk(KERN_ERR "Retry:page =%p mapping=%p nr_refs=%d page_count=%d mapcount=%d\n", + page, page->mapping, nr_refs, page_count(page), page_mapcount(page)); return -EAGAIN; + } /* * Establish migration ptes for anonymous pages or destroy pte @@ -306,8 +314,10 @@ int migrate_page_remove_references(struc /* * Retry if we were unable to remove all mappings. */ - if (page_mapcount(page)) + if (page_mapcount(page)) { + printk(KERN_ERR "Retry: page=%p mapcount = %d\n", page, page_mapcount(page)); return -EAGAIN; + } if (!mapping) { /* @@ -316,8 +326,10 @@ int migrate_page_remove_references(struc * removed the ptes. Now check if the kernel still has * pending references. */ - if (page_count(page) != nr_refs) + if (page_count(page) != nr_refs) { + printk(KERN_ERR "Anon Retry: page=%p pagecount=%d nr_refs=%d\n",page,page_count(page),nr_refs); return -EAGAIN; + } /* We are holding the only remaining reference */ newpage->index = page->index; @@ -337,6 +349,7 @@ int migrate_page_remove_references(struc if (!page_mapping(page) || page_count(page) != nr_refs || *radix_pointer != page) { write_unlock_irq(&mapping->tree_lock); + printk(KERN_ERR "mapping lock retry: page=%p page_count=%d nr_refs=%d\n", page, page_count(page),nr_refs); return -EAGAIN; } @@ -421,16 +434,19 @@ int migrate_page(struct page *newpage, s BUG_ON(PageWriteback(page)); /* Writeback must be complete */ + // printk(KERN_ERR "migrate_page: %p-%p mapping=%p\n", page, newpage, page_mapping(page)); rc = migrate_page_remove_references(newpage, page, page_mapping(page) ? 2 : 1); if (rc) { remove_migration_ptes(page, page); + printk(KERN_ERR "migrate_page failed: removing migration ptes from %p\n", page); return rc; } migrate_page_copy(newpage, page); remove_migration_ptes(page, newpage); +// printk(KERN_ERR "migrate_page: %p-%p done.\n", page, newpage); return 0; } EXPORT_SYMBOL(migrate_page); @@ -567,6 +583,7 @@ unlock_page: next: if (rc == -EAGAIN) { + printk(KERN_ERR "Migration Retry page %p Code=%d\n", page, rc); retry++; } else if (rc) { /* Permanent failure */ @@ -606,12 +623,15 @@ int buffer_migrate_page(struct page *new if (!page_has_buffers(page)) return migrate_page(newpage, page); +// printk(KERN_ERR "buffer_migrate_page: %p-%p mapping=%p\n", page, newpage, page_mapping(page)); head = page_buffers(page); rc = migrate_page_remove_references(newpage, page, 3); - if (rc) + if (rc) { + printk(KERN_ERR "* buffer_migrate_page failed: %p-%p\n", page, newpage); return rc; + } bh = head; do { @@ -646,6 +666,7 @@ int buffer_migrate_page(struct page *new } while (bh != head); +// printk(KERN_ERR "buffer_migrate_page complete %p-%p\n", page, newpage); return 0; } EXPORT_SYMBOL(buffer_migrate_page); Index: linux-2.6.17-rc1-mm2/Makefile =================================================================== --- linux-2.6.17-rc1-mm2.orig/Makefile 2006-04-11 12:14:34.000000000 -0700 +++ linux-2.6.17-rc1-mm2/Makefile 2006-04-14 14:33:49.000000000 -0700 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 17 -EXTRAVERSION =-rc1-mm2 +EXTRAVERSION =-rc1-mm2-debug NAME=Sliding Snow Leopard # *DOCUMENTATION* Index: linux-2.6.17-rc1-mm2/mm/memory.c =================================================================== --- linux-2.6.17-rc1-mm2.orig/mm/memory.c 2006-04-14 13:57:44.000000000 -0700 +++ linux-2.6.17-rc1-mm2/mm/memory.c 2006-04-14 14:33:49.000000000 -0700 @@ -434,6 +434,8 @@ 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)) { + if (is_migration_entry(pte_to_swp_entry(pte))) + printk(KERN_ERR "copy_one_pte: migration entry!\n"); swap_duplicate(pte_to_swp_entry(pte)); /* make sure dst_mm is on swapoff's mmlist. */ if (unlikely(list_empty(&dst_mm->mmlist))) { @@ -674,8 +676,12 @@ static unsigned long zap_pte_range(struc */ if (unlikely(details)) continue; - if (!pte_file(ptent)) + if (!pte_file(ptent)) { + if (is_migration_entry(pte_to_swp_entry(ptent))) + printk(KERN_ERR "zap_one_pte: migration entry\n"); + free_swap_and_cache(pte_to_swp_entry(ptent)); + } pte_clear_full(mm, addr, pte, tlb->fullmm); } while (pte++, addr += PAGE_SIZE, (addr != end && *zap_work > 0));