Kairui Song <ryncsn@xxxxxxxxx> writes: > From: Kairui Song <kasong@xxxxxxxxxxx> > > Move get_swap_device into swapin_readahead, simplify the code > and prepare for follow up commits. No. Please don't do this. Please check the get/put_swap_device() usage rule in the comments of get_swap_device(). " * When we get a swap entry, if there aren't some other ways to * prevent swapoff, such as the folio in swap cache is locked, page * table lock is held, etc., the swap entry may become invalid because * of swapoff. Then, we need to enclose all swap related functions * with get_swap_device() and put_swap_device(), unless the swap * functions call get/put_swap_device() by themselves. " This is to simplify the reasoning about swapoff and swap entry. Why does it bother you? > For the later part in do_swap_page, using swp_swap_info directly is fine > since in that context, the swap device is pinned by swapcache reference. [snip] -- Best Regards, Huang, Ying