mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jerome Marchand <jmarchan@redhat.com>
To: karam.lee@lge.com, minchan@kernel.org, ngupta@vflare.org,
	linux-kernel@vger.kernel.org
Cc: matthew.r.wilcox@intel.com, seungho1.park@lge.com
Subject: Re: [PATCH v3 3/3] zram: implement rw_page operation of zram
Date: Tue, 21 Oct 2014 15:57:29 +0200	[thread overview]
Message-ID: <54466649.901@redhat.com> (raw)
In-Reply-To: <1413876458-19279-4-git-send-email-karam.lee@lge.com>

[-- Attachment #1: Type: text/plain, Size: 2970 bytes --]

On 10/21/2014 09:27 AM, karam.lee@lge.com wrote:
> From: "karam.lee" <karam.lee@lge.com>
> 
> This patch implements rw_page operation for zram block device.
> 
> I implemented the feature in zram and tested it.
> Test bed was the G2, LG electronic mobile device, whtich has msm8974
> processor and 2GB memory.
> With a memory allocation test program consuming memory, the system
> generates swap.
> And operating time of swap_write_page() was measured.
> 
> --------------------------------------------------
> |             |   operating time   | improvement |
> |             |  (20 runs average) |             |
> --------------------------------------------------
> |with patch   |    1061.15 us      |    +2.4%    |
> --------------------------------------------------
> |without patch|    1087.35 us      |             |
> --------------------------------------------------
> 
> Each test(with paged_io,with BIO) result set shows normal distribution
> and has equal variance.
> I mean the two values are valid result to compare.
> I can say operation with paged I/O(without BIO) is faster 2.4% with
> confidence level 95%.
> 
> Signed-off-by: karam.lee <karam.lee@lge.com>
> ---
>  drivers/block/zram/zram_drv.c |   38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 4565fdc..696f0b5 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -810,8 +810,46 @@ static void zram_slot_free_notify(struct block_device *bdev,
>  	atomic64_inc(&zram->stats.notify_free);
>  }
>  
> +static int zram_rw_page(struct block_device *bdev, sector_t sector,
> +		       struct page *page, int rw)
> +{
> +	int offset, ret = 1;

Small nitpick, but why do you initialize ret to 1? It doesn't seem to be
ever used (nor is 1 a valid return value AFAICT).

It otherwise looks good.

Acked-by: Jerome Marchand <jmarchan@redhat.com>

> +	u32 index;
> +	struct zram *zram;
> +	struct bio_vec bv;
> +
> +	zram = bdev->bd_disk->private_data;
> +	if (!valid_io_request(zram, sector, PAGE_SIZE)) {
> +		atomic64_inc(&zram->stats.invalid_io);
> +		ret = -EINVAL;
> +		goto out;
> +	}
> +
> +	down_read(&zram->init_lock);
> +	if (unlikely(!init_done(zram))) {
> +		ret = -ENOMEM;
> +		goto out_unlock;
> +	}
> +
> +	index = sector >> SECTORS_PER_PAGE_SHIFT;
> +	offset = sector & (SECTORS_PER_PAGE - 1) << SECTOR_SHIFT;
> +
> +	bv.bv_page = page;
> +	bv.bv_len = PAGE_SIZE;
> +	bv.bv_offset = 0;
> +
> +	ret = zram_bvec_rw(zram, &bv, index, offset, rw);
> +
> +out_unlock:
> +	up_read(&zram->init_lock);
> +out:
> +	page_endio(page, rw, ret);
> +	return ret;
> +}
> +
>  static const struct block_device_operations zram_devops = {
>  	.swap_slot_free_notify = zram_slot_free_notify,
> +	.rw_page = zram_rw_page,
>  	.owner = THIS_MODULE
>  };
>  
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-10-21 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21  7:27 [PATCH v3 0/3] zram: add rw_page implementation for zram and clean up unnecessary parameter karam.lee
2014-10-21  7:27 ` [PATCH v3 1/3] zram: remove bio parameter from zram_bvec_rw() karam.lee
2014-10-21 14:08   ` Jerome Marchand
2014-10-21  7:27 ` [PATCH v3 2/3] zram: change parameter from vaild_io_request() karam.lee
2014-10-21 14:09   ` Jerome Marchand
2014-10-21  7:27 ` [PATCH v3 3/3] zram: implement rw_page operation of zram karam.lee
2014-10-21 13:57   ` Jerome Marchand [this message]
2014-10-22  1:28     ` karam.lee

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=54466649.901@redhat.com \
    --to=jmarchan@redhat.com \
    --cc=karam.lee@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.r.wilcox@intel.com \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=seungho1.park@lge.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

Powered by JetHome