[PATCH] limit mmap_cache nulling (2.2.19-7)

Rasmus Andersen (rasmus@jaquet.dk)
Sun, 14 Jan 2001 14:16:55 +0100


Hi.

The following patch against 2.2.19-7 adds checks in do_munmap and
merge_segments to limit the nulling of mmap_cache to the cases where
the cached vma is in the affected area.

Comments?

--- linux-2.2.19-7/mm/mmap.c~ Sun Jan 14 13:43:50 2001
+++ linux-2.2.19-7/mm/mmap.c Sun Jan 14 14:02:04 2001
@@ -689,8 +689,11 @@
kmem_cache_free(vm_area_cachep, extra);

free_pgtables(mm, prev, addr, addr+len);
+
+ if (mm->mmap_cache && mm->mmap_cache->vm_start < addr+len
+ && mm->mmap_cache->vm_end > addr)
+ mm->mmap_cache = NULL; /* Kill the cache. */

- mm->mmap_cache = NULL; /* Kill the cache. */
return 0;
}

@@ -867,7 +870,9 @@
kmem_cache_free(vm_area_cachep, mpnt);
mpnt = prev;
}
- mm->mmap_cache = NULL; /* Kill the cache. */
+ if (mm->mmap_cache && mm->mmap_cache->vm_start < end_addr
+ && mm->mmap_cache->vm_end > start_addr)
+ mm->mmap_cache = NULL; /* Kill the cache. */
}

void __init vma_init(void)

-- 
Regards,
        Rasmus(rasmus@jaquet.dk)

Are they taking DDT? -- Vice President Dan Quayle asking doctors at a Manhattan AIDS clinic about their treatments of choice, 4/30/92 (reported in Esquire, 8/92, and NY Post early May 92) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/