From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
js1304@gmail.com, Seth Jennings <sjenning@linux.vnet.ibm.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>,
Dan Magenheimer <dan.magenheimer@oracle.com>,
Nitin Gupta <ngupta@vflare.org>, Minchan Kim <minchan@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: [PATCH 2/3] staging, zcache: use zs_mem_[read/write]
Date: Wed, 16 Jan 2013 17:08:56 +0900 [thread overview]
Message-ID: <1358323737-13396-2-git-send-email-iamjoonsoo.kim@lge.com> (raw)
In-Reply-To: <1358323737-13396-1-git-send-email-iamjoonsoo.kim@lge.com>
Now, we have newly introduced APIs which reduce copy overhead of
zsmalloc for objects on page boundary.
So use it in zcache.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c
index 52b43b7..d1dee76 100644
--- a/drivers/staging/zcache/zcache-main.c
+++ b/drivers/staging/zcache/zcache-main.c
@@ -704,7 +704,7 @@ static unsigned long zv_create(struct zs_pool *pool, uint32_t pool_id,
struct tmem_oid *oid, uint32_t index,
void *cdata, unsigned clen)
{
- struct zv_hdr *zv;
+ struct zv_hdr zv;
u32 size = clen + sizeof(struct zv_hdr);
int chunks = (size + (CHUNK_SIZE - 1)) >> CHUNK_SHIFT;
unsigned long handle = 0;
@@ -716,14 +716,13 @@ static unsigned long zv_create(struct zs_pool *pool, uint32_t pool_id,
goto out;
atomic_inc(&zv_curr_dist_counts[chunks]);
atomic_inc(&zv_cumul_dist_counts[chunks]);
- zv = zs_map_object(pool, handle, ZS_MM_WO);
- zv->index = index;
- zv->oid = *oid;
- zv->pool_id = pool_id;
- zv->size = clen;
- SET_SENTINEL(zv, ZVH);
- memcpy((char *)zv + sizeof(struct zv_hdr), cdata, clen);
- zs_unmap_object(pool, handle);
+ zv.index = index;
+ zv.oid = *oid;
+ zv.pool_id = pool_id;
+ zv.size = clen;
+ SET_SENTINEL((&zv), ZVH);
+ zs_mem_write(pool, handle, &zv, 0, sizeof(struct zv_hdr));
+ zs_mem_write(pool, handle, cdata, sizeof(struct zv_hdr), clen);
out:
return handle;
}
@@ -731,15 +730,13 @@ out:
static void zv_free(struct zs_pool *pool, unsigned long handle)
{
unsigned long flags;
- struct zv_hdr *zv;
+ struct zv_hdr zv;
uint16_t size;
int chunks;
- zv = zs_map_object(pool, handle, ZS_MM_RW);
- ASSERT_SENTINEL(zv, ZVH);
- size = zv->size + sizeof(struct zv_hdr);
- INVERT_SENTINEL(zv, ZVH);
- zs_unmap_object(pool, handle);
+ zs_mem_read(pool, handle, &zv, 0, sizeof(struct zv_hdr));
+ ASSERT_SENTINEL((&zv), ZVH);
+ size = zv.size + sizeof(struct zv_hdr);
chunks = (size + (CHUNK_SIZE - 1)) >> CHUNK_SHIFT;
BUG_ON(chunks >= NCHUNKS);
--
1.7.9.5
next prev parent reply other threads:[~2013-01-16 8:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 8:08 [RFC PATCH 1/3] staging, zsmalloc: introduce zs_mem_[read/write] Joonsoo Kim
2013-01-16 8:08 ` Joonsoo Kim [this message]
2013-01-16 8:08 ` [PATCH 3/3] staging, zram: use zs_mem_[read/write] Joonsoo Kim
2013-01-16 23:59 ` [RFC PATCH 1/3] staging, zsmalloc: introduce zs_mem_[read/write] Minchan Kim
2013-01-21 7:16 ` Joonsoo Kim
2013-01-22 20:32 ` Konrad Rzeszutek Wilk
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=1358323737-13396-2-git-send-email-iamjoonsoo.kim@lge.com \
--to=iamjoonsoo.kim@lge.com \
--cc=dan.magenheimer@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=js1304@gmail.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=ngupta@vflare.org \
--cc=sjenning@linux.vnet.ibm.com \
--cc=xiaoguangrong@linux.vnet.ibm.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
all inboxes | Powered by JetHome®