the huge realloc protocol is:<div><ol><li>allocate address space with mmap.</li><li>add the new space to the huge extent tree.</li><li>remap the old pages to the new address space with mremap. this avoid a copy.</li><li>remove the old address space from the huge extent tree.</li>
</ol><div>the problem occurs when the old address space becomes free during step 3. another thread executing this protocol can get this address during the mmap in step 1. then we have a race between the first thread removing the space in step 4 and the second thread adding the space in step 2.</div>
</div><div><br></div><div>i switched the order of steps 3 and 4 to solve the problem in the huge_ralloc function. i moved the huge_dalloc call to before the mremap call.</div><div><br></div><div><br></div>