linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -V3 0/5] swap: cleanup get/put_swap_device() usage
@ 2023-05-29  6:13 Huang Ying
  2023-05-29  6:13 ` [PATCH -V3 1/5] swap: Remove get/put_swap_device() in __swap_count() Huang Ying
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Huang Ying @ 2023-05-29  6:13 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, linux-kernel, Huang Ying, David Hildenbrand,
	Hugh Dickins, Johannes Weiner, Matthew Wilcox, Michal Hocko,
	Minchan Kim, Tim Chen, Yang Shi, Yu Zhao, Chris Li, Yosry Ahmed

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

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.

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

Changelogs:

V3:

- Fix build error in [2/5], Thanks David!

- Fix comments and patch description about the folio in swap cache, Thanks David!

- Collected reviewed-by.

V2:

- Split patch per David's comments.  Thanks!

Best Regards,
Huang, Ying


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-05-31  7:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29  6:13 [PATCH -V3 0/5] swap: cleanup get/put_swap_device() usage Huang Ying
2023-05-29  6:13 ` [PATCH -V3 1/5] swap: Remove get/put_swap_device() in __swap_count() Huang Ying
2023-05-29  6:13 ` [PATCH -V3 2/5] swap, __read_swap_cache_async(): enlarge get/put_swap_device protection range Huang Ying
2023-05-31  7:45   ` David Hildenbrand
2023-05-29  6:13 ` [PATCH -V3 3/5] swap: remove __swp_swapcount() Huang Ying
2023-05-31  7:45   ` David Hildenbrand
2023-05-29  6:13 ` [PATCH -V3 4/5] swap: remove get/put_swap_device() in __swap_duplicate() Huang Ying
2023-05-31  7:46   ` David Hildenbrand
2023-05-29  6:13 ` [PATCH -V3 5/5] swap: comments get_swap_device() with usage rule Huang Ying

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox