Conversation
I skimmed through the history of the Linux kernel swap cache code today, and it was fun seeing how it scaled up throughout the years.

Originally, a single struct address_space served as the swap cache for every swap file.

In 2013, Shaohua Li split it up into a separate address_space per swap file: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=33806f06da654092182410d974b6d3c5396ea3eb.

In 2017, Ying Huang split it further into a separate address_space for each 64MB chunk of each swap file: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b3ef9daa4fc0bba742a79faecb17fdaaead083b. That's how it's been sharded ever since.
1
0
3