Messages in this thread | | | From | "Huang, Ying" <> | Subject | Re: [PATCH 16/24] mm/swap: reduce scope of get_swap_device in swapin path | Date | Wed, 22 Nov 2023 08:36:36 +0800 |
| |
Kairui Song <ryncsn@gmail.com> writes:
> From: Kairui Song <kasong@tencent.com> > > 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
| |