The patch titled Subject: zram: implement rw_page operation of zram has been added to the -mm tree. Its filename is zram-implement-rw_page-operation-of-zram.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/zram-implement-rw_page-operation-of-zram.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/zram-implement-rw_page-operation-of-zram.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "karam.lee" <karam.lee@xxxxxxx> Subject: zram: implement rw_page operation of zram 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. 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@xxxxxxx> Acked-by: Minchan Kim <minchan@xxxxxxxxxx> Acked-by: Jerome Marchand <jmarchan@xxxxxxxxxx> Cc: Matthew Wilcox <matthew.r.wilcox@xxxxxxxxx> Cc: Nitin Gupta <ngupta@xxxxxxxxxx> Cc: <seungho1.park@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/block/zram/zram_drv.c | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff -puN drivers/block/zram/zram_drv.c~zram-implement-rw_page-operation-of-zram drivers/block/zram/zram_drv.c --- a/drivers/block/zram/zram_drv.c~zram-implement-rw_page-operation-of-zram +++ a/drivers/block/zram/zram_drv.c @@ -942,8 +942,46 @@ static void zram_slot_free_notify(struct 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; + 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 = -EIO; + 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 }; _ Patches currently in -mm which might be from karam.lee@xxxxxxx are zram-remove-bio-parameter-from-zram_bvec_rw.patch zram-change-parameter-from-vaild_io_request.patch zram-implement-rw_page-operation-of-zram.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html