Barry Song <21cnbao@xxxxxxxxx> writes: > From: Chuanhua Han <hanchuanhua@xxxxxxxx> > > When a large folio is found in the swapcache, the current implementation > requires calling do_swap_page() nr_pages times, resulting in nr_pages > page faults. This patch opts to map the entire large folio at once to > minimize page faults. Additionally, redundant checks and early exits > for ARM64 MTE restoring are removed. For large folios in reclaiming, it makes sense to restore all PTE mappings to the large folio to reduce the number of page faults. But for large folios swapped in, I think that it's better to map one PTE which triggers the page fault only. Because this makes us get the opportunity to trap the page accesses to the sub-pages of the large folio that is swapped in ahead (kind of swap readahead). Then we can decide the order of large folio swapin based on the readahead window information. That is, we may need to check PageReadahead() to decide whether to map all PTEs in the future. -- Best Regards, Huang, Ying