dmarti/memory-hog — pull request #3 by raphaelsc (2014-05-23 22:24:10+00:00)
Title: readme: Explain concurrency considerations

Removing the following lines from the README:
TODO: shrinker callbacks can be called any time (?)
TODO: concurrency considerations -- treat like signal handlers (?)

Explanation:
Yes, shrinker callbacks can be called at any time (on memory pressure),
but the code that calls shrinker callbacks holds a mutex lock.
Therefore, there is no concurrency consideration as shrinker callbacks
will never be executed concurrently.

Follow the OSv core code responsible for calling shrinker callbacks:
WITH_LOCK(_shrinkers_mutex) {
for (auto s : _shrinkers) {
size_t freed = s->request_memory(target, hard());
trace_memory_reclaim(s->name().c_str(), target, freed);
}
}