Garbage Collection
As explained in the section "Routing Cache Garbage Collection" in Chapter 30, there are two kinds of garbage collection:
To free memory when a shortage is detected. This is actually split into two tasks, one synchronous and one asynchronous. The synchronous task is triggered at irregular times by particular conditions, and the asynchronous task runs more or less regularly at the expiration of a timer.
To clean up
dst_entrystructures that the kernel asked to be removed, but that could not be deleted right away because someone still held a reference to them.
This section covers both the synchronous and asynchronous cases of the first type of garbage collection. The section "Deleting DST Entries" goes into detail on the other type.
Both synchronous and asynchronous garbage collection use a common routine to decide
whether a given dst_entry instance is eligible for
deletion: rt_may_expire. The routine accepts two
parameters (tmo1, tmo2) that represent the minimum time that candidates must have spent in the
cache before being eligible for deletion. Specifically, tmo2 applies to those candidates that are considered particularly good for
deletion, and tmo1 applies to all the other candidates,
as described in the section "Examples of
eligible cache victims" in Chapter
30. The ip_rt_gc_timeout parameter specifies the
time for other entries in the cache.
The lower those two values are, the more likely it is that entries will be deleted. That's why, as shown in the section " ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access