aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorMark Johnston <[email protected]>2022-01-31 13:58:45 -0500
committerGitHub <[email protected]>2022-01-31 10:58:45 -0800
commitfdcb79b52e2d4f231d5cbd2ae6fffb1be275558e (patch)
treee461b3f8521966d52ba49f6b37a0d0bb4433d4f1 /cmd
parent73e972af7a704472892f8c491f2ce3f36ebe1ae7 (diff)
spl: Don't check FreeBSD rwlocks for double initialization (#13019)
This checking breaks KMSAN since it effectively loads from uninitialized memory to see if the lock is already initialized. This happens in dnode_cons() for example. This checking is not very useful, partly due to UMA's memory trashing, and is already disabled for mutexes. Make mutexes and rwlocks consistent: remove double-initialization checking for rwlocks, and pass SX_NEW to disable the same checking in lock_init(). No functional change intended, this affects only debug builds. As a side note, kmem cache constructors/destructors are implemented suboptimally on FreeBSD. FreeBSD's slab allocator, UMA, supports two pairs of constructors/destructors: ctor/dtor and init/fini. The former are called upon every allocation and free of an item, while the latter are called when an item is imported or released from a zone, respectively. That is, when a slab is allocated to a particular cache, it is subdivided into items, and init is called on each. fini is called when the slab is being prepared to be freed back to the system. The intent is for them to initialize static fields such as locks, which do not need to be initialized upon each allocation of an item. In illumos, kmem_cache constructors/destructors correspond to UMA's init/fini callbacks. However, in the SPL they are implemented as UMA ctor/dtors, meaning that they get called far more often than necessary. This may be difficult to fix, since new code may assume the kmem cache ctor/dtors are in fact called upon each allocation/free, and there doesn't seem to be a clear way to implement the intended semantics on Linux. Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Mark Johnston <[email protected]> Closes #13019
Diffstat (limited to 'cmd')
0 files changed, 0 insertions, 0 deletions