Miaohe Lin
04094226d6
mm/z3fold: fix z3fold_reclaim_page races with z3fold_free
...
Think about the below scenario:
CPU1 CPU2
z3fold_reclaim_page z3fold_free
spin_lock(&pool->lock) get_z3fold_header -- hold page_lock
kref_get_unless_zero
kref_put--zhdr->refcount can be 1 now
!z3fold_page_trylock
kref_put -- zhdr->refcount is 0 now
release_z3fold_page
WARN_ON(!list_empty(&zhdr->buddy)); -- we're on buddy now!
spin_lock(&pool->lock); -- deadlock here!
z3fold_reclaim_page might race with z3fold_free and will lead to pool lock
deadlock and zhdr buddy non-empty warning. To fix this, defer getting the
refcount until page_lock is held just like what __z3fold_alloc does. Note
this has the side effect that we won't break the reclaim if we meet a soon
to be released z3fold page now.
Link: https://lkml.kernel.org/r/20220429064051.61552-9-linmiaohe@huawei.com
Fixes: dcf5aedb24f8 ("z3fold: stricter locking and more careful reclaim")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-05-27 09:33:44 -07:00
..
2022-05-19 14:08:55 -07:00
2022-05-13 07:20:19 -07:00
2022-05-25 10:47:49 -07:00
2022-03-22 15:57:01 -07:00
2022-03-28 16:52:57 -04:00
2022-01-06 12:27:03 +01:00
2021-05-05 11:27:21 -07:00
2021-05-05 11:27:24 -07:00
2022-03-22 15:57:09 -07:00
2022-03-22 15:57:09 -07:00
2022-05-13 16:48:57 -07:00
2022-05-09 18:20:45 -07:00
2022-03-24 19:06:45 -07:00
2022-01-15 16:30:28 +02:00
2022-03-22 15:57:11 -07:00
2022-03-22 15:57:01 -07:00
2022-05-19 14:08:55 -07:00
2022-05-13 07:20:09 -07:00
2022-03-21 13:01:35 -04:00
2022-01-22 08:33:38 +02:00
2021-05-05 11:27:26 -07:00
2021-05-05 11:27:26 -07:00
2022-05-09 18:20:47 -07:00
2022-04-08 14:20:36 -10:00
2022-05-13 07:20:09 -07:00
2022-05-19 14:08:49 -07:00
2022-01-15 16:30:29 +02:00
2022-05-13 16:48:56 -07:00
2022-04-28 23:16:15 -07:00
2022-05-13 07:20:11 -07:00
2022-05-13 07:20:19 -07:00
2022-02-14 19:51:47 +01:00
2022-05-27 09:33:43 -07:00
2021-04-30 11:20:38 -07:00
2021-04-30 11:20:39 -07:00
2021-09-08 11:50:24 -07:00
2022-05-19 14:08:53 -07:00
2022-01-15 16:30:28 +02:00
2022-05-19 14:08:50 -07:00
2022-04-15 14:49:56 -07:00
2022-05-25 10:47:48 -07:00
2022-04-08 14:20:36 -10:00
2022-03-23 18:03:08 -07:00
2022-05-09 18:20:49 -07:00
2022-04-28 23:16:15 -07:00
2022-01-15 16:30:27 +02:00
2022-03-27 13:36:06 -07:00
2022-05-19 14:08:53 -07:00
2022-03-05 11:08:32 -08:00
2022-05-13 16:48:56 -07:00
2022-05-19 14:08:54 -07:00
2022-05-19 14:08:51 -07:00
2022-05-19 14:08:54 -07:00
2021-10-18 06:17:01 -06:00
2022-05-09 18:20:44 -07:00
2022-05-09 18:20:44 -07:00
2022-05-13 07:20:17 -07:00
2022-05-13 07:20:09 -07:00
2022-04-01 11:46:09 -07:00
2021-04-30 11:20:42 -07:00
2021-07-23 17:43:28 -07:00
2022-05-19 14:08:50 -07:00
2022-04-28 23:16:12 -07:00
2022-04-21 20:01:10 -07:00
2022-03-22 17:03:12 -07:00
2022-05-13 07:20:11 -07:00
2022-05-13 07:20:07 -07:00
2021-04-30 11:20:37 -07:00
2022-04-25 10:11:49 -07:00
2022-04-21 20:01:10 -07:00
2022-05-27 09:33:43 -07:00
2022-01-15 16:30:27 +02:00
2022-04-29 14:36:58 -07:00
2022-05-19 14:08:54 -07:00
2022-05-09 18:20:49 -07:00
2022-05-27 09:33:43 -07:00
2022-05-19 14:08:54 -07:00
2021-04-30 11:20:36 -07:00
2021-06-29 10:53:47 -07:00
2021-06-29 10:53:47 -07:00
2022-05-13 07:20:17 -07:00
2022-04-28 23:16:10 -07:00
2022-04-28 23:15:57 -07:00
2021-06-29 10:53:49 -07:00
2022-05-13 07:20:18 -07:00
2021-07-04 18:30:17 +00:00
2022-03-08 09:30:46 -05:00
2021-07-04 18:30:17 +00:00
2022-05-13 07:20:18 -07:00
2021-05-07 00:26:35 -07:00
2022-05-13 07:20:05 -07:00
2021-05-05 11:27:27 -07:00
2022-03-22 15:57:08 -07:00
2022-04-01 14:40:42 -04:00
2022-05-19 14:08:54 -07:00
2022-04-15 14:49:54 -07:00
2022-05-25 10:47:47 -07:00
2021-04-16 16:10:36 -07:00
2021-05-22 15:09:07 -10:00
2022-05-13 07:20:07 -07:00
2022-05-13 07:20:07 -07:00
2022-04-15 14:49:55 -07:00
2022-05-13 07:20:07 -07:00
2022-04-15 14:49:55 -07:00
2022-04-28 23:16:16 -07:00
2022-05-13 07:20:19 -07:00
2022-03-08 09:30:46 -05:00
2022-05-19 14:08:51 -07:00
2022-05-19 14:08:50 -07:00
2022-05-19 14:08:52 -07:00
2022-05-13 07:20:15 -07:00
2022-05-19 14:08:52 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 16:11:53 -07:00
2022-05-13 07:20:11 -07:00
2022-05-09 18:20:47 -07:00
2022-05-13 07:20:18 -07:00
2021-11-06 13:30:40 -07:00
2022-05-25 10:47:48 -07:00
2022-05-19 14:08:53 -07:00
2022-04-21 20:01:09 -07:00
2022-05-27 09:33:44 -07:00
2021-07-01 11:06:03 -07:00
2022-01-15 16:30:31 +02:00
2022-01-22 08:33:37 +02:00
2022-05-19 14:08:53 -07:00