[patch 106/192] mm/zswap.c: avoid unnecessary copy-in at map time

From
Andrew Morton <akpm@linux-foundation.org>
Date
2021-07-01 01:52:55
Also in
mm-commits
Reply to
Andrew Morton, 2021-07-01
From: Miaohe Lin <linmiaohe@huawei.com>
Subject: 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 (local)
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Colin Ian King <redacted>
Cc: Dan Streetman <redacted>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Seth Jennings <redacted>
Cc: Tian Tao <tiantao6@hisilicon.com>
Cc: Vitaly Wool <redacted>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/zswap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/zswap.c~mm-zswapc-avoid-unnecessary-copy-in-at-map-time
+++ a/mm/zswap.c
@@ -1203,7 +1203,7 @@ static int zswap_frontswap_store(unsigne
 		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);
_
Thread (212 messages) 212 messages, 11 authors, last reply 2021-07-12
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help