Skip to contentSkip to conversation

Do we still need skip swapcache logic in do_swap_page() for SWP_SYNCHRONOUS_IO?

DISCUSSION Huang, Ying 2 participants 2 messages Dec 17, 2020 Memory management

lore
Share & tools
lore
#0 lore raw

Hi, Minchan,

In commit 0bcac06f27d7 ("mm, swap: skip swapcache for swapin of synchronous device"), swap cache management is skipped for super fast device with synchronous IO. That did help performance for these devices much at that time. But in commit aae466b0052e ("mm/swap: implement workingset detection for anonymous LRU"), swap cache is used to record workingset shadow value. So it needs to be operated anyway in swapin in common cases. Although lockless operation get_shadow_from_swap_cache() is used now, in swap_free() path, swap cache will be locked. So now, is it still necessary to skip swap cache logic in do_swap_page() for SWP_SYNCHRONOUS_IO? Maybe we can just simplify the logic?

Best Regards,
Huang, Ying

#1 lore raw

Hi Huang,

Quoted 12 lines · Ying

Hi, Minchan,

In commit 0bcac06f27d7 ("mm, swap: skip swapcache for swapin of synchronous device"), swap cache management is skipped for super fast device with synchronous IO. That did help performance for these devices much at that time. But in commit aae466b0052e ("mm/swap: implement workingset detection for anonymous LRU"), swap cache is used to record workingset shadow value. So it needs to be operated anyway in swapin in common cases. Although lockless operation get_shadow_from_swap_cache() is used now, in swap_free() path, swap cache will be locked. So now, is it still necessary to skip swap cache logic in do_swap_page() for SWP_SYNCHRONOUS_IO? Maybe we can just simplify the logic?

Since we have xarray and better swap management(I believe) since then, could you try to measure swap-in performance?
If the gain is negligible today, we definitely could drop it.

Thank you.