--- zzzz-none-000/linux-2.4.17/mm/mmap.c 2001-11-04 18:17:20.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/mm/mmap.c 2004-11-24 13:22:34.000000000 +0000 @@ -534,6 +534,11 @@ } vma->vm_file = file; get_file(file); + /* + * Subdrivers can clear VM_IO if their mappings are + * valid pages inside mem_map[] + */ + vma->vm_flags |= VM_IO; error = file->f_op->mmap(file, vma); if (error) goto unmap_and_free_vma; @@ -569,7 +574,7 @@ fput(file); /* Undo any partial mapping done by a device driver. */ - zap_page_range(mm, vma->vm_start, vma->vm_end - vma->vm_start); + zap_page_range(mm, vma->vm_start, vma->vm_end - vma->vm_start, ZPR_NORMAL); free_vma: kmem_cache_free(vm_area_cachep, vma); return error; @@ -882,6 +887,8 @@ * old method of shifting the VA >> by PGDIR_SHIFT doesn't work. */ start_index = pgd_index(first); + if (start_index < FIRST_USER_PGD_NR) + start_index = FIRST_USER_PGD_NR; end_index = pgd_index(last); if (end_index > start_index) { clear_page_tables(mm, start_index, end_index - start_index); @@ -967,7 +974,7 @@ remove_shared_vm_struct(mpnt); mm->map_count--; - zap_page_range(mm, st, size); + zap_page_range(mm, st, size, ZPR_PARTITION); /* * Fix the mapping, and free the old area if it wasn't reused. @@ -1127,7 +1134,7 @@ } mm->map_count--; remove_shared_vm_struct(mpnt); - zap_page_range(mm, start, size); + zap_page_range(mm, start, size, ZPR_PARTITION); if (mpnt->vm_file) fput(mpnt->vm_file); kmem_cache_free(vm_area_cachep, mpnt);