title: If you fork() and the forked (child) process exits are all the VM pages still marked COW in the parent?
body: <p>On Linux, if you fork() and the forked (child) process exits are all the virtual memory pages still marked as copy-on-write in the parent?</p>
  
  <p>I think the pages will stay marked as COW as anything else would probably be prohibitively expensive to implement, probably requiring per-page ref counts and other expensive book-keeping. But I was wondering the other day, if I fork a process to execute some code in a "stable snapshot" of the current process. What happens when the child process exits? Do all the memory pages in the parent stay marked as copy-on-write? That means that forking in a process with a lot of virtual memory (e.g. 128GB+) only to execute some code for a few minutes would cause lingering performance degradation in the parent process, for hours or even days afterward (not to mention the fork call itself which would not be cheap.)</p>
  
  <p>I'm just curious as to what the actual behavior is on Linux (and I have no idea how I could test it.)</p>