Tian Tao
fc6697a89f
mm/zswap: add the flag can_sleep_mapped
Patch series "Fix the compatibility of zsmalloc and zswap".
Patch #1 adds a flag to zpool, then zswap used to determine if zpool
drivers such as zbud/z3fold/zsmalloc will enter an atomic context after
mapping.
The difference between zbud/z3fold and zsmalloc is that zsmalloc requires
an atomic context that since its map function holds a preempt-disabled,
but zbud/z3fold don't require an atomic context. So patch #2 sets flag
sleep_mapped to true indicating that zbud/z3fold can sleep after mapping.
zsmalloc didn't support sleep after mapping, so don't set that flag to
true.
This patch (of 2):
Add a flag to zpool, named is "can_sleep_mapped", and have it set true for
zbud/z3fold, not set this flag for zsmalloc, so its default value is
false. Then zswap could go the current path if the flag is true; and if
it's false, copy data from src to a temporary buffer, then unmap the
handle, take the mutex, process the buffer instead of src to avoid
sleeping function called from atomic context.
[natechancellor@gmail.com: add return value in zswap_frontswap_load]
Link: https://lkml.kernel.org/r/20210121214804.926843-1-natechancellor@gmail.com
[tiantao6@hisilicon.com: fix potential memory leak]
Link: https://lkml.kernel.org/r/1611538365-51811-1-git-send-email-tiantao6@hisilicon.com
[colin.king@canonical.com: fix potential uninitialized pointer read on tmp]
Link: https://lkml.kernel.org/r/20210128141728.639030-1-colin.king@canonical.com
[tiantao6@hisilicon.com: fix variable 'entry' is uninitialized when used]
Link: https://lkml.kernel.org/r/1611223030-58346-1-git-send-email-tiantao6@hisilicon.comLink: https://lkml.kernel.org/r/1611035683-12732-1-git-send-email-tiantao6@hisilicon.com
Link: https://lkml.kernel.org/r/1611035683-12732-2-git-send-email-tiantao6@hisilicon.com
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Vitaly Wool <vitaly.wool@konsulko.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reported-by: Mike Galbraith <efault@gmx.de>
Cc: Barry Song <song.bao.hua@hisilicon.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-02-26 09:41:01 -08:00
..
2021-02-24 13:38:31 -08:00
2021-02-24 13:38:28 -08:00
2020-07-10 13:54:00 -07:00
2021-02-26 09:41:00 -08:00
2020-09-01 09:19:43 +02:00
2021-02-24 13:38:34 -08:00
2021-02-24 13:38:27 -08:00
2021-02-24 13:38:27 -08:00
2020-10-13 18:38:32 -07:00
2020-01-31 10:30:38 -08:00
2020-10-13 18:38:29 -07:00
2021-02-26 09:40:59 -08:00
2020-08-14 19:56:56 -07:00
2020-12-15 12:13:38 -08:00
2020-12-15 12:13:38 -08:00
2021-02-24 13:38:32 -08:00
2021-01-24 10:34:52 -08:00
2020-08-12 10:58:02 -07:00
2021-02-26 09:40:59 -08:00
2021-02-24 13:38:33 -08:00
2021-02-24 13:38:35 -08:00
2020-10-16 11:11:16 -07:00
2020-12-15 12:13:39 -08:00
2021-02-26 09:40:59 -08:00
2020-08-07 11:33:26 -07:00
2021-01-12 14:15:31 +01:00
2020-12-15 12:13:46 -08:00
2021-02-26 09:40:59 -08:00
2020-10-13 18:38:27 -07:00
2020-12-15 12:13:47 -08:00
2021-02-24 13:38:30 -08:00
2020-08-12 10:57:59 -07:00
2021-02-23 13:39:45 -08:00
2021-01-12 14:15:31 +01:00
2020-12-15 12:13:41 -08:00
2021-02-22 13:01:23 -08:00
2021-02-24 13:38:30 -08:00
2021-02-26 09:41:00 -08:00
2021-02-26 09:41:00 -08:00
2021-02-24 13:38:33 -08:00
2021-02-24 13:38:34 -08:00
2021-02-24 13:38:31 -08:00
2021-02-26 09:41:00 -08:00
2021-02-24 13:38:29 -08:00
2021-01-24 14:27:16 +01:00
2021-02-26 09:41:01 -08:00
2020-12-15 12:13:47 -08:00
2020-12-15 12:13:41 -08:00
2021-02-24 13:38:30 -08:00
2021-01-29 20:02:29 +01:00
2020-12-15 12:13:41 -08:00
2020-12-15 14:48:04 -08:00
2021-02-24 13:38:30 -08:00
2021-02-24 13:38:30 -08:00
2020-06-09 09:39:14 -07:00
2021-01-28 14:10:31 +00:00
2021-02-24 13:38:34 -08:00
2021-02-26 09:41:00 -08:00
2020-12-15 12:13:40 -08:00
2020-12-15 22:46:19 -08:00
2020-12-15 14:48:03 -08:00
2021-02-24 13:38:29 -08:00
2020-12-15 12:13:45 -08:00
2021-02-24 13:38:27 -08:00
2020-12-22 12:55:08 -08:00
2021-02-24 13:38:30 -08:00
2020-06-09 09:39:13 -07:00
2020-12-15 12:13:41 -08:00
2021-01-05 11:33:00 -08:00
2020-06-09 09:39:14 -07:00
2020-08-12 10:57:55 -07:00
2020-08-12 10:57:55 -07:00
2020-08-12 10:57:55 -07:00
2020-08-12 10:57:55 -07:00
2021-02-14 18:15:15 +00:00
2020-08-07 11:33:26 -07:00
2021-02-24 13:38:30 -08:00
2021-01-12 18:12:54 -08:00
2020-12-22 12:55:08 -08:00
2020-10-17 13:49:08 -06:00
2021-02-26 09:41:01 -08:00
2020-08-21 09:52:53 -07:00
2021-02-26 09:40:59 -08:00
2020-10-16 11:11:19 -07:00
2020-08-07 11:33:29 -07:00
2021-02-24 13:38:31 -08:00
2021-02-24 13:38:31 -08:00
2021-02-24 13:38:29 -08:00
2021-02-24 13:38:26 -08:00
2021-02-24 13:38:31 -08:00
2020-08-07 11:33:27 -07:00
2020-10-16 11:11:18 -07:00
2020-06-03 20:09:48 -07:00
2021-02-24 13:38:28 -08:00
2021-02-26 09:40:59 -08:00
2021-02-26 09:40:59 -08:00
2021-02-24 13:38:28 -08:00
2021-02-26 09:40:59 -08:00
2020-08-12 10:57:58 -07:00
2020-08-12 10:57:55 -07:00
2021-01-22 15:24:04 -08:00
2020-06-10 19:14:18 -07:00
2021-02-12 12:56:55 +01:00
2020-04-02 09:35:31 -07:00
2021-02-24 13:38:34 -08:00
2021-02-26 09:41:00 -08:00
2021-02-24 13:38:34 -08:00
2021-02-24 13:38:34 -08:00
2020-10-13 18:38:34 -07:00
2021-02-26 09:41:01 -08:00
2020-12-15 12:13:46 -08:00
2021-02-26 09:41:01 -08:00