linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <sjenning@redhat.com>,
	<ddstreet@ieee.org>, <vitaly.wool@konsulko.com>
Cc: <bigeasy@linutronix.de>, <nathan@kernel.org>,
	<colin.king@canonical.com>, <tiantao6@hisilicon.com>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	<linmiaohe@huawei.com>
Subject: [PATCH 2/3] mm/zswap.c: avoid unnecessary copy-in at map time
Date: Sat, 22 May 2021 17:22:41 +0800	[thread overview]
Message-ID: <20210522092242.3233191-3-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210522092242.3233191-1-linmiaohe@huawei.com>

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.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/zswap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.23.0



  parent reply	other threads:[~2021-05-22  9:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22  9:22 [PATCH 0/3] Cleanup and fixup for zswap Miaohe Lin
2021-05-22  9:22 ` [PATCH 1/3] mm/zswap.c: remove unused function zswap_debugfs_exit() Miaohe Lin
2021-05-22  9:22 ` Miaohe Lin [this message]
2021-05-22  9:22 ` [PATCH 3/3] mm/zswap.c: fix two bugs in zswap_writeback_entry() Miaohe Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210522092242.3233191-3-linmiaohe@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=colin.king@canonical.com \
    --cc=ddstreet@ieee.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nathan@kernel.org \
    --cc=sjenning@redhat.com \
    --cc=tiantao6@hisilicon.com \
    --cc=vitaly.wool@konsulko.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox