From: Cristiano Giuffrida Date: Tue, 20 Jul 2010 18:57:25 +0000 (+0000) Subject: COW for physically contiguous blocks in VM X-Git-Tag: v3.1.8~178 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mult.png?a=commitdiff_plain;h=40b4e71db2525a51b1ed3bd7c9925fe8608872d3;p=minix.git COW for physically contiguous blocks in VM --- diff --git a/servers/vm/mmap.c b/servers/vm/mmap.c index 9257f732f..47d715b57 100644 --- a/servers/vm/mmap.c +++ b/servers/vm/mmap.c @@ -61,6 +61,11 @@ PUBLIC int do_mmap(message *m) return EINVAL; } + /* Contiguous phys memory has to be preallocated. */ + if((m->VMM_FLAGS & (MAP_CONTIG|MAP_PREALLOC)) == MAP_CONTIG) { + return EINVAL; + } + if(m->VMM_FLAGS & MAP_PREALLOC) mfflags |= MF_PREALLOC; if(m->VMM_FLAGS & MAP_LOWER16M) vrflags |= VR_LOWER16MB; if(m->VMM_FLAGS & MAP_LOWER1M) vrflags |= VR_LOWER1MB; diff --git a/servers/vm/region.c b/servers/vm/region.c index 2b6c67d9d..752f1382d 100644 --- a/servers/vm/region.c +++ b/servers/vm/region.c @@ -969,6 +969,7 @@ physr_iter *iter; u32_t allocflags; phys_bytes physaddr; struct phys_region *newpr; + int region_has_single_block; int written = 0; #if SANITYCHECKS written = ph->written; @@ -1014,7 +1015,8 @@ physr_iter *iter; /* Put new free memory in. */ allocflags = vrallocflags(region->flags); - assert(!(allocflags & PAF_CONTIG)); + region_has_single_block = (offset == 0 && length == region->length); + assert(region_has_single_block || !(allocflags & PAF_CONTIG)); assert(!(allocflags & PAF_CLEAR)); if(map_new_physblock(vmp, region, offset, length,