The page frame reclaiming algorithm must take care of many
kinds of pages owned by User Mode processes, disk caches and memory
caches; moreover, it has to obey several heuristic rules. Thus, it is
not surprising that the PFRA is composed of a large number of functions.
Figure 17-3 shows the
main PFRA functions; an arrow denotes a function invocation, thus for
try_to_free_pages( ) invokes
shrink_slab( ), and
As you can see, there are several "entry points" for the PFRA. Actually, page frame reclaiming is performed on essentially three occasions:
The kernel detects a "low on memory" condition.
The kernel must free memory because it is entering in the suspend-to-disk state (we don't further discuss this case).
A kernel thread is activated periodically to perform memory reclaiming, if necessary.
Figure 17-3. The main functions of the PFRA
Low on memory reclaiming is activated in the following cases:
_ _alloc_pages( ...