sapling/eden/fs/utils
Xavier Deguillard 88dcfa7bb3 utils: add an RcuPtr class
Summary:
RCU is a synchronization mechanism that allows for very fast reads, at the
expense of slower writes. This is achieved by having the reader sometimes
reading a stale pointer when concurrent to a write, at which point the writer
will delay reclaiming the old data to a later moment where it is known that no
reader can hold a pointer to the old data.

Doing that allows for the read operations to be significantly faster than using
a Synchronized lock. Folly's documentation claims a read lock/unlock of RCU
runs in ~4ns, while the same for Synchronized is ~26ns.

Due to the writers cost, RCU is perfectly suited for places where reads needs
to be as fast as possible, and writes are very infrequent. One typical example
is when caching an application's configuration, we can expect reading the
configuration values more frequently than it is being reloaded, and in the case
where the configuration mismatch, a stale configuration can be tolerated by the
application.

In EdenFS, we can use RCU on Windows to make sure that unmounting a repository
will wait on all the pending callbacks.

Reviewed By: kmancini

Differential Revision: D25351536

fbshipit-source-id: 050ca0337e67ae195f4f16062dddb60f584af692
2020-12-11 14:10:58 -08:00
..
test utils: add an RcuPtr class 2020-12-11 14:10:58 -08:00
BucketedLog.h remove dependency on glog 2020-11-10 16:31:15 -08:00
BufVec.h fuse: move BufVec.h to utils/ 2020-09-02 12:15:48 -07:00
Bug.cpp refactor the EDEN_BUG() macro 2019-11-22 15:38:33 -08:00
Bug.h Remove folly's ColdClass, which was of dubious utility 2020-01-09 13:09:56 -08:00
ChronoParse.cpp Replace Folly Format with fmt in logger to reduce binary size 2019-11-18 05:53:08 -08:00
ChronoParse.h Tidy up license headers 2019-10-11 05:28:23 -07:00
ChronoUnit.cpp Tidy up license headers 2019-10-11 05:28:23 -07:00
ChronoUnit.gperf update license header in remaining files 2019-06-19 17:02:46 -07:00
ChronoUnit.h Tidy up license headers 2019-10-11 05:28:23 -07:00
Clock.cpp utils: remove UnixClock::getElapsedTimeInNs 2020-09-30 15:50:08 -07:00
Clock.h utils: remove UnixClock::getElapsedTimeInNs 2020-09-30 15:50:08 -07:00
CMakeLists.txt utils: remove //eden/fs/utils/test:linux_test 2020-11-16 08:29:04 -08:00
CoverageSet.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
CoverageSet.h Tidy up license headers 2019-10-11 05:28:23 -07:00
DirType.cpp assert that the dtype constants have consistent values on all platforms 2020-04-28 13:23:52 -07:00
DirType.h Cleaning up second definitions of dtype_t 2020-03-10 12:27:51 -07:00
EnumValue.h add enumValue utility function 2020-04-28 17:41:24 -07:00
FaultInjector.cpp build deprecation-clean 2019-11-12 16:31:54 -08:00
FaultInjector.h Tidy up license headers 2019-10-11 05:28:23 -07:00
FileDescriptor.cpp eden: fix buffer advance in FileDescriptor::wrapFull 2020-09-02 23:38:18 -07:00
FileDescriptor.h eden: introduce SpawnedProcess 2020-09-01 13:31:32 -07:00
FileUtils.cpp utils: truncate nul bytes after obtaining a temp file name 2020-10-22 16:24:17 -07:00
FileUtils.h win: move win/utils onto utils/ 2020-09-22 09:09:56 -07:00
Future.h add a collectSafe function 2020-02-03 11:30:50 -08:00
FutureUnixSocket.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
FutureUnixSocket.h Tidy up license headers 2019-10-11 05:28:23 -07:00
Guid.h utils: fix zero-initialization in Guid.h 2020-10-02 10:50:54 -07:00
Handle.h remove dependency on glog 2020-11-10 16:31:15 -08:00
IDGen.cpp Tidy up license headers 2019-10-11 05:28:23 -07:00
IDGen.h Tidy up license headers 2019-10-11 05:28:23 -07:00
IoFuture.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
IoFuture.h Tidy up license headers 2019-10-11 05:28:23 -07:00
LazyInitialize.h Tidy up license headers 2019-10-11 05:28:23 -07:00
LeaseCache.h Tidy up license headers 2019-10-11 05:28:23 -07:00
MappedDiskVector.h remove dependency on glog 2020-11-10 16:31:15 -08:00
Memory.cpp introduce an assertZeroBits function to double-check the compiler 2020-09-13 01:37:14 -07:00
Memory.h introduce an assertZeroBits function to double-check the compiler 2020-09-13 01:37:14 -07:00
NotImplemented.h utils: move win/utils/Stub.h to utils/NotImplemented.h 2020-09-16 12:31:46 -07:00
PathFuncs.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
PathFuncs.h improve PathComponent parse failure error messaging 2020-11-17 12:53:39 -08:00
PathMap.h edenfs: fixup PathMap copy and move ctor for case sensitivity 2020-09-23 09:46:57 -07:00
Pipe.cpp eden: introduce FileDescriptor and Pipe types 2020-09-01 13:31:32 -07:00
Pipe.h eden: introduce FileDescriptor and Pipe types 2020-09-01 13:31:32 -07:00
ProcessAccessLog.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
ProcessAccessLog.h remove dependency on glog 2020-11-10 16:31:15 -08:00
ProcessNameCache.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
ProcessNameCache.h utils: compile ProcessAccessLog and ProcessNameCache on Windows 2020-09-04 16:14:25 -07:00
ProcUtil.cpp Remove dead includes in eden 2020-10-09 15:25:47 -07:00
ProcUtil.h utils: add a platform independent FileUtils 2020-08-14 18:56:33 -07:00
Rcu.h utils: add an RcuPtr class 2020-12-11 14:10:58 -08:00
SortedInsert.h Tidy up license headers 2019-10-11 05:28:23 -07:00
SpawnedProcess.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
SpawnedProcess.h eden: introduce SpawnedProcess 2020-09-01 13:31:32 -07:00
SSLContext.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
SSLContext.h Tidy up license headers 2019-10-11 05:28:23 -07:00
StatTimes.h eden: add stattimes helpers for win32 2020-04-24 15:57:27 -07:00
StringConv.cpp utils: move multibyteToWideString to a cpp file 2020-09-30 16:29:13 -07:00
StringConv.h utils: move multibyteToWideString to a cpp file 2020-09-30 16:29:13 -07:00
Synchronized.h Tidy up license headers 2019-10-11 05:28:23 -07:00
SystemError.h Tidy up license headers 2019-10-11 05:28:23 -07:00
Thread.cpp fs: ifdef linux/macos only files 2020-09-23 12:20:41 -07:00
Thread.h disable pthread cancellation on the FuseChannel threads 2020-05-08 20:41:50 -07:00
TimeUtil.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
TimeUtil.h Tidy up license headers 2019-10-11 05:28:23 -07:00
UnboundedQueueExecutor.cpp Tidy up license headers 2019-10-11 05:28:23 -07:00
UnboundedQueueExecutor.h Tidy up license headers 2019-10-11 05:28:23 -07:00
UnixSocket.cpp remove dependency on glog 2020-11-10 16:31:15 -08:00
UnixSocket.h edenfs: remove use of fork from StartupLogger 2020-09-18 17:22:39 -07:00
UserInfo.cpp win: move win/utils onto utils/ 2020-09-22 09:09:56 -07:00
UserInfo.h eden: use SpawnedProcess to start privhelper 2020-09-18 17:22:39 -07:00
Utf8.cpp add some utf-8 helper functions 2020-06-10 19:29:51 -07:00
Utf8.h add some utf-8 helper functions 2020-06-10 19:29:51 -07:00
WinError.cpp Back out "prjfs: handle concurrent file/directory removal" 2020-12-10 07:42:38 -08:00
WinError.h edenfs: move WinError to eden/fs/utils 2020-09-17 09:08:58 -07:00
XAttr.cpp fs: ifdef linux/macos only files 2020-09-23 12:20:41 -07:00
XAttr.h Tidy up license headers 2019-10-11 05:28:23 -07:00