while (++offset <= si->highest_bit) { if (!si->swap_map[offset]) { goto checks;

goto lowest;

return 0;

If this also fails, the kernel jumps to the lowest label, thus restarting the search at the lower limit of the free area. This does not produce an endless loop because highest_bit is set to 0 when the last available page is allocated. As the previous code section shows, this is an abort condition for the search.

We must now examine what happens if there is no current cluster. In this case, the kernel attempts to open a new cluster. This presupposes that an empty section consisting of at least swapfile_cluster empty slots is present in the swap area. As clusters do not require any particular alignment of their starting position, the kernel starts searching from the lowest position as of which there are free entries and which is defined by lowest_bit (the code shown is at the position of the /* Find new cluster */ comment inserted above):

Continue reading here: Mmswapfilec

Was this article helpful?

0 0