Commit r345200 (new ARC reclamation threads) looks suspicious to me.
Lev Serebryakov
lev at FreeBSD.org
Mon May 20 15:38:23 UTC 2019
I'm looking at last commit to
'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c' (r345200) and
have one question.
Is it Ok for two threads to communicate via simple global variable? Now
new code has (line 315):
static boolean_t arc_adjust_needed = B_FALSE;
And after that some threads run code like this:
mutex_enter(&arc_adjust_lock);
arc_adjust_needed = B_TRUE;
mutex_exit(&arc_adjust_lock);
zthr_wakeup(arc_adjust_zthr);
And thread `arc_adjust_zthr` has code like this (line 4874):
return (arc_adjust_needed);
This variable is not atomic. It is not updated and/or read in atomic
way. What code gives guarantees that `arc_adjust_zthr` will detect this
change? I don't see any. Am I wrong?
--
// Lev Serebryakov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20190520/f9d05c26/attachment.sig>
More information about the freebsd-fs
mailing list