Commit r345200 (new ARC reclamation threads) looks suspicious to me.

Lev Serebryakov lev at
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:

arc_adjust_needed = B_TRUE;

 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: <>

More information about the freebsd-fs mailing list