linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -V2 0/5] swap: cleanup get/put_swap_device() usage
@ 2023-05-22  7:09 Huang Ying
  2023-05-22  7:09 ` [PATCH -V2 1/5] swap: Remove get/put_swap_device() in __swap_count() Huang Ying
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: Huang Ying @ 2023-05-22  7:09 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

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


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

end of thread, other threads:[~2023-05-23  8:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22  7:09 [PATCH -V2 0/5] swap: cleanup get/put_swap_device() usage Huang Ying
2023-05-22  7:09 ` [PATCH -V2 1/5] swap: Remove get/put_swap_device() in __swap_count() Huang Ying
2023-05-22 11:54   ` David Hildenbrand
2023-05-23  1:22   ` Yosry Ahmed
2023-05-23  1:47     ` Huang, Ying
2023-05-23  1:51       ` Yosry Ahmed
2023-05-22  7:09 ` [PATCH -V2 2/5] swap, __read_swap_cache_async(): enlarge get/put_swap_device protection range Huang Ying
2023-05-22 12:01   ` David Hildenbrand
2023-05-23  0:43     ` Huang, Ying
2023-05-22  7:09 ` [PATCH -V2 3/5] swap: remove __swp_swapcount() Huang Ying
2023-05-22 12:03   ` David Hildenbrand
2023-05-23  0:50     ` Huang, Ying
2023-05-22  7:09 ` [PATCH -V2 4/5] swap: remove get/put_swap_device() in __swap_duplicate() Huang Ying
2023-05-22 12:06   ` David Hildenbrand
2023-05-23  0:56     ` Huang, Ying
2023-05-23  7:59       ` David Hildenbrand
2023-05-23  1:39   ` Yosry Ahmed
2023-05-22  7:09 ` [PATCH -V2 5/5] swap: comments get_swap_device() with usage rule Huang Ying
2023-05-22 12:07   ` David Hildenbrand
2023-05-23  1:00     ` Huang, Ying
2023-05-23  1:37   ` Yosry Ahmed

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