Shrinking Other Caches

In addition to the page cache, the kernel manages other caches that are generally based on the slab (or slub or slob, but we'll use the term slab for all of them in the following) mechanism discussed in Chapter 3.

Slabs manage frequently required data structures to ensure that memory managed page-by-page by the buddy system is used more efficiently and that instances of the data types can be allocated quickly and easily as a result of caching.

Kernel subsystems that use their own caches of this type are able to register shrinker functions dynamically with the kernel; these are called when memory is low to free some memory space already in use (technically, there is no fixed association between slabs and shrinker functions, but currently there are no other cache types for which shrinkers are used).

In addition to routines for registering and removing shrinker functions, the kernel must also provide methods to initiate cache shrinking. These are closely examined in the following sections.

Continue reading here: Data Structures

Was this article helpful?

0 0