ComputationalRadiationPhysics/scatteralloc — pull request #6 by slizzered (2014-07-31 12:12:07+00:00)
Title: fixed bug with wrong bitmask in PTE

This bugfix is backported from https://github.com/ComputationalRadiationPhysics/mallocMC/commit/48afb4936e6010048cfd782bcc5f526fe985e3a4

idea of how the bug worked (in hierarchical pages):
- currently selected onpagemask is not full.
- thread starts searching for free slot
- new free slots appear where the thread already searched, while the free
slots in unvisited places disappear
- thread does not find a free slot, sets `_ptes[page].bitmask` at position of
the onpagemask to 1, indicating that the onpagemask/segment is completely
filled.
- since `_ptes[page].bitmask` indicates, that the onpagemask/segment is
completely filled, no other threads will ever enter this segment.
- The bug hits, since the `_ptes[page].bitmask` on position onpagemask is
only set to 0 by a thread that had a completely filled onpagemask and removes
1 element. Since the onpagemask was never completely filled, no thread will
perform the reset
- memory is lost.