Repository navigation
Conversation
POSIX shm segments always live in /dev/shm, which is lost when it is replaced, e.g. on container recreation. usePosixShmDirectory(dir) keeps normal-page segments as files in a user-provided directory (a tmpfs volume that outlives the container) instead. Huge-page segments keep using hugePageMountDir, and PosixShmSegment now uses its directory argument for normal pages too; ShmManager passes one only for huge pages or with this option. To keep the change small, the directory is not saved with the cache: SharedMemAttach with a different directory throws, and the files in the previous custom directory are left for the user to delete. Cross-host persistence rejects the option, as it does huge pages.
Contributor
|
@AlnisM has imported this pull request. If you are a Meta employee, you can view this in D131231119. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
usePosixShmDirectory(dir)creates the POSIX shm segments as files indirinstead of/dev/shm. The use case is a persistent cache on a tmpfs volume: the volume survives a container restart, the container's/dev/shmdoesn't.Only normal-page segments are affected; huge-page segments keep using their hugetlbfs mount. Most of the diff passes the directory down to the places that open or remove segments, including
ReadOnlySharedCacheView. Cross-host persistence (PersistenceManager) rejects the option, the same way it rejects huge pages.To keep the change small, the directory is not saved in the shm metadata. If it changes between runs,
SharedMemAttachthrows as when there is no saved cache, and segment files in the old directory are left for the user to delete. The persistence guide has a short paragraph on the option.Test Plan:
CacheAllocatorConfigTest.PosixShmDirectory: argument checks andserialize().CacheAllocatorConfigTest.PosixShmDirectoryWarmRoll: write an item, shut down, attach read-only and read-write from the directory and read the item back, thencleanupStrayShmSegments()empties the directory.