From: Miaohe Lin Date: Thu, 1 Jul 2021 01:52:52 +0000 (-0700) Subject: mm/zswap.c: avoid unnecessary copy-in at map time X-Git-Tag: Ubuntu-5.15.0-12.12~2360^2~84 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ae34af1f11d0a6ae849b7605d15df9798dab7b46;p=mirror_ubuntu-jammy-kernel.git mm/zswap.c: avoid unnecessary copy-in at map time The buf mapped via zpool_map_handle() is only used to store compressed page buffer and there is no information to extract from it. So we could use ZPOOL_MM_WO instead to avoid unnecessary copy-in at map time. Link: https://lkml.kernel.org/r/20210522092242.3233191-3-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Cc: Colin Ian King Cc: Dan Streetman Cc: Nathan Chancellor Cc: Sebastian Andrzej Siewior Cc: Seth Jennings Cc: Tian Tao Cc: Vitaly Wool Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/zswap.c b/mm/zswap.c index e93459319fdb..c27ce9f2cdf8 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1203,7 +1203,7 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset, zswap_reject_alloc_fail++; goto put_dstmem; } - buf = zpool_map_handle(entry->pool->zpool, handle, ZPOOL_MM_RW); + buf = zpool_map_handle(entry->pool->zpool, handle, ZPOOL_MM_WO); memcpy(buf, &zhdr, hlen); memcpy(buf + hlen, dst, dlen); zpool_unmap_handle(entry->pool->zpool, handle);