Skip to content

swap: cleanup get/put_swap_device() usage

Huang Ying linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 15 repliesIn review

v2 from the cover letter

- Split patch per David's comments. Thanks!

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5swap: Remove get/put_swap_device() in __swap_count()mm/swapfile.c+2 -84 replies
2/5swap, __read_swap_cache_async(): enlarge get/put_swap_device protection rangemm/swap_state.c+22 -112 replies
3/5swap: remove __swp_swapcount()include/linux/swap.h mm/swapfile.c+3 -212 replies
4/5swap: remove get/put_swap_device() in __swap_duplicate()mm/swapfile.c+1 -44 replies
5/5swap: comments get_swap_device() with usage rulemm/swapfile.c+9 -33 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchDavid HildenbrandYosry Ahmed
1/5R-b R-b
2/5
3/5
4/5R-b
5/5R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH -V2 0/5] swap: cleanup get/put_swap_device() usage

The general rule to use a swap entry is as follows.

When we get a swap entry, if there isn't some other way to prevent swapoff, such as page lock for swap cache, page table lock, 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.

Based on the above rule, all get/put_swap_device() usage are checked and cleaned up if necessary.

Changelogs:

v2:

- Split patch per David's comments. Thanks!

Best Regards,
Huang, Ying