# HG changeset patch # User lively@dlively2 # Node ID 2d63622421e93895f9f5c99d900e80e78943b0c6 # Parent 0b79b3c194b17dcf4d7916e33628feb321cc1e05 Robert's workaround for the infamous Eeek! page_mapcount(page) went negative! bug. [Bug id:] 3914 [Reviewed By:] Ben & Dave L diff -r 0b79b3c194b1 -r 2d63622421e9 linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Sat Jun 10 13:23:11 2006 -0400 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c Tue Jun 13 11:05:44 2006 -0400 @@ -244,7 +244,7 @@ static int privcmd_mmap(struct file * fi static int privcmd_mmap(struct file * file, struct vm_area_struct * vma) { /* DONTCOPY is essential for Xen as copy_page_range is broken. */ - vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY; + vma->vm_flags |= VM_RESERVED | VM_IO | VM_DONTCOPY | VM_PRIVCMD; return 0; } diff -r 0b79b3c194b1 -r 2d63622421e9 linux-2.6-xen-sparse/include/linux/mm.h --- a/linux-2.6-xen-sparse/include/linux/mm.h Sat Jun 10 13:23:11 2006 -0400 +++ b/linux-2.6-xen-sparse/include/linux/mm.h Tue Jun 13 11:05:44 2006 -0400 @@ -169,6 +169,7 @@ extern unsigned int kobjsize(const void #ifdef CONFIG_XEN #define VM_FOREIGN 0x04000000 /* Has pages belonging to another VM */ #endif +#define VM_PRIVCMD 0x08000000 /* Pages belong to privcmd mmap */ #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS diff -r 0b79b3c194b1 -r 2d63622421e9 linux-2.6-xen-sparse/mm/memory.c --- a/linux-2.6-xen-sparse/mm/memory.c Sat Jun 10 13:23:11 2006 -0400 +++ b/linux-2.6-xen-sparse/mm/memory.c Tue Jun 13 11:05:44 2006 -0400 @@ -409,6 +409,10 @@ struct page *vm_normal_page(struct vm_ar print_bad_pte(vma, pte, addr); return NULL; } + + /* This vma points to foreign pages */ + if (vma->vm_flags & VM_PRIVCMD) + return NULL; /* * NOTE! We still have PageReserved() pages in the page