lkml.org 
[lkml]   [2018]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 7/7] zram: writeback throttle
On (12/03/18 11:40), Minchan Kim wrote:
[..]
> + down_read(&zram->init_lock);
> + atomic64_set(&zram->stats.bd_wb_limit, val);
> + if (val == 0)
> + zram->stop_writeback = false;
> + up_read(&zram->init_lock);

[..]

> + if (zram->stop_writeback) {
> + ret = -EIO;
> + break;
> + }
> +
> if (!blk_idx) {
> blk_idx = alloc_block_bdev(zram);
> if (!blk_idx) {
> @@ -694,6 +732,11 @@ static ssize_t writeback_store(struct device *dev,
> zram_set_element(zram, index, blk_idx);
> blk_idx = 0;
> atomic64_inc(&zram->stats.pages_stored);
> + if (atomic64_add_unless(&zram->stats.bd_wb_limit,
> + -1 << (PAGE_SHIFT - 12), 0)) {
> + if (atomic64_read(&zram->stats.bd_wb_limit) == 0)
> + zram->stop_writeback = true;
> + }

Do we need ->stop_writeback? It should be identical to

atomic64_read(&zram->stats.bd_wb_limit) == 0


Otherwise, looks good!

-ss

\
 
 \ /
  Last update: 2018-12-03 06:51    [W:0.145 / U:20.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site