@@ -68,26 +68,24 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemNewT, Config config)
6868 accessContainer_ (std::make_unique<AccessContainer>(
6969 config_.accessConfig,
7070 shmManager_
71- ->createShm (detail::kShmHashTableName ,
72- AccessContainer::getRequiredSize (
73- config_.accessConfig.getNumBuckets()),
74- nullptr,
75- ShmSegmentOpts(config_.accessConfig.getPageSize(),
76- false,
77- config_.usePosixShm))
71+ ->createShm (
72+ detail::kShmHashTableName ,
73+ AccessContainer::getRequiredSize (
74+ config_.accessConfig.getNumBuckets()),
75+ nullptr,
76+ ShmSegmentOpts(config_.accessConfig.getPageSize(), false))
7877 .addr,
7978 compressor_,
8079 [this](Item* it) -> WriteHandle { return acquire (it); })),
8180 chainedItemAccessContainer_(std::make_unique<AccessContainer>(
8281 config_.chainedItemAccessConfig,
8382 shmManager_
84- ->createShm (detail::kShmChainedItemHashTableName ,
85- AccessContainer::getRequiredSize (
86- config_.chainedItemAccessConfig.getNumBuckets()),
87- nullptr,
88- ShmSegmentOpts(config_.accessConfig.getPageSize(),
89- false,
90- config_.usePosixShm))
83+ ->createShm (
84+ detail::kShmChainedItemHashTableName ,
85+ AccessContainer::getRequiredSize (
86+ config_.chainedItemAccessConfig.getNumBuckets()),
87+ nullptr,
88+ ShmSegmentOpts(config_.accessConfig.getPageSize(), false))
9189 .addr,
9290 compressor_,
9391 [this](Item* it) -> WriteHandle { return acquire (it); })),
@@ -103,8 +101,7 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemNewT, Config config)
103101 config_.isNvmCacheEncryptionEnabled (),
104102 config_.isNvmCacheTruncateAllocSizeEnabled ()} {
105103 initCommon (false );
106- shmManager_->removeShm (detail::kShmInfoName ,
107- PosixSysVSegmentOpts (config_.usePosixShm ));
104+ shmManager_->removeShm (detail::kShmInfoName );
108105}
109106
110107template <typename CacheTrait>
@@ -122,19 +119,17 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemAttachT, Config config)
122119 accessContainer_(std::make_unique<AccessContainer>(
123120 deserializer_->deserialize<AccessSerializationType>(),
124121 config_.accessConfig,
125- shmManager_->attachShm(
126- detail::kShmHashTableName ,
127- nullptr ,
128- ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm)),
122+ shmManager_->attachShm(detail::kShmHashTableName ,
123+ nullptr ,
124+ ShmSegmentOpts (PageSizeT::NORMAL, false )),
129125 compressor_,
130126 [this](Item* it) -> WriteHandle { return acquire (it); })),
131127 chainedItemAccessContainer_(std::make_unique<AccessContainer>(
132128 deserializer_->deserialize<AccessSerializationType>(),
133129 config_.chainedItemAccessConfig,
134- shmManager_->attachShm(
135- detail::kShmChainedItemHashTableName ,
136- nullptr ,
137- ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm)),
130+ shmManager_->attachShm(detail::kShmChainedItemHashTableName ,
131+ nullptr ,
132+ ShmSegmentOpts (PageSizeT::NORMAL, false )),
138133 compressor_,
139134 [this](Item* it) -> WriteHandle { return acquire (it); })),
140135 chainedItemLocks_(config_.chainedItemsLockPower,
@@ -155,8 +150,7 @@ CacheAllocator<CacheTrait>::CacheAllocator(SharedMemAttachT, Config config)
155150 // We will create a new info shm segment on shutDown(). If we don't remove
156151 // this info shm segment here and the new info shm segment's size is larger
157152 // than this one, creating new one will fail.
158- shmManager_->removeShm (detail::kShmInfoName ,
159- PosixSysVSegmentOpts (config_.usePosixShm ));
153+ shmManager_->removeShm (detail::kShmInfoName );
160154}
161155
162156template <typename CacheTrait>
@@ -174,7 +168,8 @@ std::unique_ptr<MemoryAllocator>
174168CacheAllocator<CacheTrait>::createNewMemoryAllocator() {
175169 ShmSegmentOpts opts;
176170 opts.alignment = sizeof (Slab);
177- opts.typeOpts = PosixSysVSegmentOpts (config_.usePosixShm );
171+ opts.typeOpts =
172+ config_.usePosixShm ? PosixShmSegmentOpts{} : SysVShmSegmentOpts{};
178173 return std::make_unique<MemoryAllocator>(
179174 getAllocatorConfig (config_),
180175 shmManager_
@@ -189,7 +184,8 @@ std::unique_ptr<MemoryAllocator>
189184CacheAllocator<CacheTrait>::restoreMemoryAllocator() {
190185 ShmSegmentOpts opts;
191186 opts.alignment = sizeof (Slab);
192- opts.typeOpts = PosixSysVSegmentOpts (config_.usePosixShm );
187+ opts.typeOpts =
188+ config_.usePosixShm ? PosixShmSegmentOpts{} : SysVShmSegmentOpts{};
193189 return std::make_unique<MemoryAllocator>(
194190 deserializer_->deserialize <MemoryAllocator::SerializationType>(),
195191 shmManager_
@@ -298,8 +294,7 @@ void CacheAllocator<CacheTrait>::initWorkers() {
298294template <typename CacheTrait>
299295std::unique_ptr<Deserializer> CacheAllocator<CacheTrait>::createDeserializer() {
300296 auto infoAddr = shmManager_->attachShm (
301- detail::kShmInfoName , nullptr ,
302- ShmSegmentOpts (PageSizeT::NORMAL, false , config_.usePosixShm ));
297+ detail::kShmInfoName , nullptr , ShmSegmentOpts (PageSizeT::NORMAL, false ));
303298 return std::make_unique<Deserializer>(
304299 reinterpret_cast <uint8_t *>(infoAddr.addr ),
305300 reinterpret_cast <uint8_t *>(infoAddr.addr ) + infoAddr.size );
@@ -3162,7 +3157,8 @@ void CacheAllocator<CacheTrait>::saveRamCache() {
31623157 ioBuf->coalesce ();
31633158
31643159 ShmSegmentOpts opts;
3165- opts.typeOpts = PosixSysVSegmentOpts (config_.usePosixShm );
3160+ opts.typeOpts =
3161+ config_.usePosixShm ? PosixShmSegmentOpts{} : SysVShmSegmentOpts{};
31663162
31673163 void * infoAddr =
31683164 shmManager_
0 commit comments