Re: [PATCH v5 3/9] mm/swap: Split swap cache into 64MB trunks

From: Andi Kleen
Date: Wed Jan 11 2017 - 18:19:48 EST


> Switching from a single radix-tree to an array of radix-trees to reduce
> contention seems a bit hacky. That we can do this and have everything
> continue to work tells me that we're simply using an inappropriate data
> structure to hold this info.

What would you use instead?

A tree with fine grained locking?

FWIW too fine grained locking (e.g. on every node) is usually a bad idea:

it slows down the single thread performance and it causes much more overhead
when there is actual contention because too much time is spent bouncing cache
lines around.

So I actually like the "a little bit more fine grained, but not too much"
approach.

Or a hash table?

Not sure if this would work here.

-Andi