Index: linux-2.6.14-rc5-mm1/mm/mempolicy.c =================================================================== --- linux-2.6.14-rc5-mm1.orig/mm/mempolicy.c 2005-11-04 11:50:24.000000000 -0800 +++ linux-2.6.14-rc5-mm1/mm/mempolicy.c 2005-11-04 14:17:19.000000000 -0800 @@ -185,13 +185,14 @@ static struct mempolicy *mpol_new(int mo } /* Check if we are the only process mapping the page in question */ -static inline int single_mm_mapping(struct mm_struct *mm, +static int single_mm_mapping(struct mm_struct *mm, struct address_space *mapping) { struct vm_area_struct *vma; struct prio_tree_iter iter; int rc = 1; + printk(KERN_ERR "single_mm_mapping: %p %p\n", mm, mapping); spin_lock(&mapping->i_mmap_lock); vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, 0, ULONG_MAX) if (mm != vma->vm_mm) { @@ -214,10 +215,16 @@ out: static void migrate_page_add(struct vm_area_struct *vma, struct page *page, struct list_head *pagelist, unsigned long flags) { + printk(KERN_ERR "migrate_page_add %p %p %p %lx\n", vma, page, pagelist, flags); + printk(KERN_ERR "page->mapping %p flags =%lx count=%d map=%d\n", page->mapping, page->flags, page_count(page), page_mapcount(page)); + + /* pages without mapping will be migrated */ + /* * Avoid migrating a page that is shared by others and not writable. */ if ((flags & MPOL_MF_MOVE_ALL) || + !page->mapping || PageAnon(page) || mapping_writably_mapped(page->mapping) || single_mm_mapping(vma->vm_mm, page->mapping) @@ -258,6 +265,7 @@ static int check_pte_range(struct vm_are continue; } nid = pfn_to_nid(pfn); + printk(KERN_ERR "check_pte_range: Node=%d nodes=%lx flags=%lx\n", nid, nodes->bits[0], flags); if (!node_isset(nid, *nodes) == !(flags & MPOL_MF_INVERT)) { if (pagelist) { struct page *page = pfn_to_page(pfn); @@ -357,12 +365,16 @@ check_range(struct mm_struct *mm, unsign int err; struct vm_area_struct *first, *vma, *prev; + printk(KERN_ERR "check_range %p %lx-%lx nodes=%lx flags=%lx pl=%p\n",mm, start, end, nodes->bits[0], flags, pagelist); first = find_vma(mm, start); + printk(KERN_ERR "1\n"); if (!first) return ERR_PTR(-EFAULT); - if (first->vm_flags & VM_RESERVED) + printk(KERN_ERR "2\n"); + if (first->vm_flags & VM_RESERVED && !(flags & MPOL_MF_DISCONTIG_OK)) return ERR_PTR(-EACCES); prev = NULL; + printk(KERN_ERR "3\n"); for (vma = first; vma && vma->vm_start < end; vma = vma->vm_next) { if (!(flags & MPOL_MF_DISCONTIG_OK)) { if (!vma->vm_next && vma->vm_end < end) @@ -370,12 +382,15 @@ check_range(struct mm_struct *mm, unsign if (prev && prev->vm_end < vma->vm_start) return ERR_PTR(-EFAULT); } + printk(KERN_ERR "4\n"); if (!is_vm_hugetlb_page(vma) && ((flags & MPOL_MF_STRICT) || ((flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) && vma_migratable(vma) ))) { unsigned long endvma = vma->vm_end; + + printk(KERN_ERR "vma from %lx-%lx\n",vma->vm_start, vma->vm_end); if (endvma > end) endvma = end; if (vma->vm_start > start) @@ -462,6 +477,7 @@ static int migrate_pages_to(struct list_ struct page *page; struct list_head *p; + printk(KERN_ERR "Migrate pages to\n"); list_for_each(p, pagelist) { if (vma) page = alloc_page_vma(GFP_HIGHUSER, vma, @@ -495,12 +511,17 @@ long do_mbind(unsigned long start, unsig int err; LIST_HEAD(pagelist); + printk(KERN_ERR "do_mbind\n"); if ((flags & ~(unsigned long)(MPOL_MF_STRICT | MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) || mode > MPOL_MAX) return -EINVAL; + + printk(KERN_ERR "1\n"); if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_RESOURCE)) return -EPERM; + + printk(KERN_ERR "2\n"); if (start & ~PAGE_MASK) return -EINVAL; @@ -510,14 +531,17 @@ long do_mbind(unsigned long start, unsig len = (len + PAGE_SIZE - 1) & PAGE_MASK; end = start + len; + printk(KERN_ERR "3\n"); if (end < start) return -EINVAL; if (end == start) return 0; + printk(KERN_ERR "4\n"); if (mpol_check_policy(mode, nmask)) return -EINVAL; + printk(KERN_ERR "5\n"); new = mpol_new(mode, nmask); if (IS_ERR(new)) return PTR_ERR(new); @@ -688,6 +712,7 @@ int migrate_to_node(struct mm_struct *mm LIST_HEAD(pagelist); int err = 0; + printk(KERN_ERR "migrate_to_node %p %d->%d %x\n",mm, source, dest,flags); nodes_clear(nmask); node_set(source, nmask); @@ -702,7 +727,8 @@ int migrate_to_node(struct mm_struct *mm if (!list_empty(&pagelist)) putback_lru_pages(&pagelist); - } + } else + printk(KERN_ERR "pagelist empty\n"); return err; } @@ -720,6 +746,7 @@ int do_migrate_pages(struct mm_struct *m nodemask_t tmp; int busy = 0; + printk("do_migrate_pages\n"); down_read(&mm->mmap_sem); /* Find a 'source' bit set in 'tmp' whose corresponding 'dest' @@ -861,6 +888,7 @@ asmlinkage long sys_mbind(unsigned long nodemask_t nodes; int err; + printk(KERN_ERR "sys_mbind\n"); err = get_nodes(&nodes, nmask, maxnode); if (err) return err; Index: linux-2.6.14-rc5-mm1/Makefile =================================================================== --- linux-2.6.14-rc5-mm1.orig/Makefile 2005-10-31 14:11:08.000000000 -0800 +++ linux-2.6.14-rc5-mm1/Makefile 2005-11-04 12:01:58.000000000 -0800 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 14 -EXTRAVERSION =-rc5-mm1 +EXTRAVERSION =-rc5-mm1-mig NAME=Affluent Albatross # *DOCUMENTATION* Index: linux-2.6.14-rc5-mm1/mm/vmscan.c =================================================================== --- linux-2.6.14-rc5-mm1.orig/mm/vmscan.c 2005-11-04 11:50:31.000000000 -0800 +++ linux-2.6.14-rc5-mm1/mm/vmscan.c 2005-11-04 12:01:58.000000000 -0800 @@ -734,6 +734,7 @@ int migrate_page_remove_references(struc void migrate_page_copy(struct page *newpage, struct page *page) { + printk(KERN_ERR "migrate_page_copy %p->%p\n", page, newpage); copy_highpage(newpage, page); if (PageError(page)) @@ -821,6 +822,7 @@ int migrate_pages(struct list_head *l, s int swapwrite = current->flags & PF_SWAPWRITE; int rc = 0; + printk(KERN_ERR "migrate pages\n"); if (!swapwrite) current->flags |= PF_SWAPWRITE; Index: linux-2.6.14-rc5-mm1/mm/rmap.c =================================================================== --- linux-2.6.14-rc5-mm1.orig/mm/rmap.c 2005-11-04 10:24:09.000000000 -0800 +++ linux-2.6.14-rc5-mm1/mm/rmap.c 2005-11-04 12:01:58.000000000 -0800 @@ -583,6 +583,7 @@ static int try_to_unmap_one(struct page spin_unlock(&mmlist_lock); } set_pte_at(mm, address, pte, swp_entry_to_pte(entry)); + printk(KERN_ERR "swap pte installed at %p %ld %p\n", page, address, pte); BUG_ON(pte_file(*pte)); dec_mm_counter(mm, anon_rss); } else