On Tue, Jan 21, 2020 at 11:12:06PM +0100, Mateusz Guzik wrote:
> 
> This does not happen with rb trees and would not happen with the hash
> table if there was bucket locking instead of per-cpu.
> 
> I would stick to hash tables since they are easier to scale (both with
> and without locks).
> 
> For instance if 2 threads look up "/bin" and "/usr" and there is no
> hash collision, they lock *separate* buckets and suffer less in terms
> of cacheline bouncing. In comparison with rb trees they will take the
> same lock. Of course this similarly does not scale if they are looking
> up the same path.

I think there's probably a generic bucket-locked hashtable implementation
in one of the code contributions Coyote Point made long ago.  That said,
we're talking about a screenful of code, so it's not like it'd be hard to
rewrite, either.  Do we want such a thing?  Or do we want to press on
towards more modern "that didn't work, try again" approaches like
pserialize or the COW scheme you describe?

-- 
 Thor Lancelot Simon                                         t...@panix.com
  "Whether or not there's hope for change is not the question.  If you
   want to be a free person, you don't stand up for human rights because
   it will work, but because it is right."      --Andrei Sakharov

Reply via email to