Mmswapfilec

cluster:

offset = si->cluster_next;

if (offset > si->highest_bit) lowest: offset = si->lowest_bit;

si->lowest_bit++; if (offset == si->highest_bit)

if (si->inuse_pages == si->pages) { si->lowest_bit = si->max; si->highest_bit = 0;

si->swap_map[offset] = 1; si->cluster_next = offset + 1;

return offset;

6The implementation still includes a few explicit scheduler calls, not reproduced here. They are executed to minimize kernel latency times when the kernel spends too long searching for a free swap slot.

Once the entries for the lower and upper limits have been updated (if necessary), the kernel increments the offset for the next search by 1 and uses the offset of the position just found.

If the proposed page is not free, the kernel iterates over the positions until it finds the first one that is free:

Continue reading here: Mmswapfilec

Was this article helpful?

0 0