SRCU question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi to Paul & the rcu mailing list,

I've got a problem I'm trying to figure out if I can adapt SRCU for.

Within bcachefs, currently struct btree obects, and now also btree_cached_key,
aren't freed until the filesystem is torn down, because btree iterators contain
pointers to them and will drop and retake locks (iff a sequence number hasn't
changed) without holding a ref. With the btree key cache code, this is now
something I need to fix.

What I plan on doing is having struct btree_trans (container for btree
iterators) hold an srcu read lock while it's alive. But, I don't want to just
use call_srcu to free the btree/btree_cached_key objects, because btree trans
objects can at times be fairly long lived and the existing code can reuse these
objects for other btree nodes/btree cached keys immediately. Freeing them with
call_srcu() would break that; I could have my callback function check if the
object has been reused before freeing, but I'd still have a problem when the
object gets freed a second time before the first call_scru() has finished.

What I'm wondering is if the SRCU code has a well defined notion of a clock that
I could make use of. What I would like to do is, instead of doing call_srcu() to
free the object - just mark that object with the current SRCU context time, and
then when my shrinkers run they can free objects that haven't been reused and
are old enough according the the current SRCU time.

Thoughts?



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux