Please sign in to comment.
Speed up vsm_findseg
This speeds up vsm_findseg by keeping a direct pointer to the struct vsm_seg it points to in the vsm_fantom. To prevent stale vsm_fantoms in an application from causing segfaults, the last serial number seen is also kept on the fantom. If this serial number does not match, the slow path of iterating all segs to find the right match is done, and the fantom is updated to make any subsequent calls on the same fantom take the fast path. With this patch the fantoms store 2 serial numbers and a direct pointer to the seg. To fit this in struct vsm_fantom without breaking the ABI, the unused chunk pointer value has been repurposed, giving us two uintptr_t priv variables to work with. The direct segment pointer occupies one, and the two serial numbers occupy one half each of the other. This limits the bits for each serial to only 16 bits on 32 bit systems. But only direct matches is done, and it is unlikely that a stale fantom should have the exact right value to be accepted as valid.
- Loading branch information...
Showing with 57 additions and 16 deletions.