Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!uwvax!provolone.cs.wisc.edu!shekita From: shekita@provolone.cs.wisc.edu (E Shekita) Newsgroups: comp.os.mach Subject: bug in Mach 2.5 in copy-on-write? Message-ID: <10871@spool.cs.wisc.edu> Date: 20 Jul 90 19:05:20 GMT Sender: news@spool.cs.wisc.edu Lines: 40 There seems to be a bug in Mach 2.5 with copy-on-write (COW), where it forgets to unmark a page as COW once the virtual copy of the page has taken a COW fault. Here's an example that picks up the bug: ----------------------------------------------------------------------- int i; /* index */ char* source_page; /* vm_read() source */ char* destination_page; /* vm_read() destination */ vm_allocate(task_self(), (vm_address_t*) &source_page, vm_page_size, TRUE); for (i = 0; i < 100; i++) { /* * Update the source page. This shouldn't trigger a COW fault. */ source_page[0] = 'a'; /* * Virtually copy the source page to the destination page. * After the copy, the source and destination pages should * both be marked as COW. */ vm_read(task_self(), (vm_address_t) source_page, vm_page_size, (vm_address_t*) &destination_page, &readCount); /* * Update the destination page. This should trigger a COW fault, * but it should also unmark the source page as COW. */ destination_page[0] = 'b'; } --------------------------------------------------------------------------- If you run this loop and calculate the number of COW faults that occured in it using vm_statistics(), you'll find that the number of COW faults is 199. Shouldn't it be on the order of 100?... Any comments from the CMU folks? Gene