[sheepdog] object cache reclaim refacotor & fix
Liu Yuan
namei.unix at gmail.com
Wed Aug 1 12:03:44 CEST 2012
The old reclaim algorithm tries to push dirty object synchronously, which does
lock/unlock mutex dance because push operation is considerably long opration.
This dramtically obfuscate the code and logic.
We don't actually do this dance because flush opreations is periodically issued
from guests in a relatively short window (for e.g, less than 1 minuts in Linux)
if there are dirty pages in kernel's memory. That is, in most cases, we'll see
more 'clean' objects than dirty objects.
The new algorithm is simple yet efficient (similar to Linux kernel's page cache):
- only tries to reclaim 'clean' object, which doesn't has any dirty updates,
in a LRU list.
- spip the object when it is in R/W operation.
- skip the dirty object if it is not in push(writeback) phase.
- wait on the dirty object if it is in push phase.
This patchset also fix other racy problems.
Thanks,
Yuan
More information about the sheepdog
mailing list