You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Eviction happens only during writes (or a time-to-live based setting, which we'll ignore for purposes here). This happens at WritableHashTable's implementation, below.
This takes locks, so structure is expected to be protected during the process. So it's removed if time to live has expired, or access-bit is off. If it was accessed recently, it lives until another full rotation (because this process unsets the part).
To summarize, unless there is a use-case where a multiple readers take a context and read several times - L4's lock-free is debatable. It's locking on read and write through Context -> EpochRefPolicy -> AddRef / RemoveRef.
If we don't release a context, the memory is never freed, and waiting somewhere to be cleaned up.
This is tested using the following diff on L4, which checks if actions are indeed performed in the background cleanup thread, with browsermt/bergamot-translator:
Eviction: Write
Eviction happens only during writes (or a time-to-live based setting, which we'll ignore for purposes here). This happens at WritableHashTable's implementation, below.
L4/inc/L4/HashTable/Cache/HashTable.h
Lines 277 to 294 in 8103d00
This takes locks, so structure is expected to be protected during the process. So it's removed if time to live has expired, or access-bit is off. If it was accessed recently, it lives until another full rotation (because this process unsets the part).
L4/inc/L4/HashTable/Cache/HashTable.h
Lines 261 to 262 in 8103d00
Removes are just "mark for Removals":
L4/inc/L4/HashTable/ReadWrite/HashTable.h
Lines 404 to 413 in 8103d00
This is a problem, we're leaking memory here, while we await the action-queue to clear these up.
Epochs are incremented and references to epochs are held, so:
L4/inc/L4/LocalMemory/EpochManager.h
Lines 58 to 68 in 8103d00
The following can keep running forever if a
frontIndex
L4::Context
is not freed while the final ones keep on piling up.L4/inc/L4/Epoch/EpochQueue.h
Lines 126 to 139 in 8103d00
Reads
There are checks if this record is past it's time-to-live, in which case this is returned false.
L4/inc/L4/HashTable/Cache/HashTable.h
Lines 63 to 85 in 8103d00
Misc:
There is a check for our size_t key, so collisions are improbable.
L4/inc/L4/HashTable/ReadWrite/HashTable.h
Lines 59 to 62 in 8103d00
Any successful evictions trigger an increment in global-epoch. This runs every n seconds on a background thread.
L4/inc/L4/LocalMemory/EpochManager.h
Lines 35 to 37 in 8103d00
The text was updated successfully, but these errors were encountered: