Messages in this thread | | | Date | Wed, 21 Nov 2018 13:55:51 +0900 | From | Sergey Senozhatsky <> | Subject | Re: [PATCH 4/6] zram: support idle page writeback |
| |
On (11/16/18 16:20), Minchan Kim wrote: > + zram_set_flag(zram, index, ZRAM_UNDER_WB); > + zram_slot_unlock(zram, index); > + if (zram_bvec_read(zram, &bvec, index, 0, NULL)) { > + zram_slot_lock(zram, index); > + zram_clear_flag(zram, index, ZRAM_UNDER_WB); > + zram_slot_unlock(zram, index); > + continue; > + } > + > + bio_init(&bio, &bio_vec, 1); > + bio_set_dev(&bio, zram->bdev); > + bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9); > + bio.bi_opf = REQ_OP_WRITE | REQ_SYNC; > + > + bio_add_page(&bio, bvec.bv_page, bvec.bv_len, > + bvec.bv_offset); > + /* > + * XXX: A single page IO would be inefficient for write > + * but it would be not bad as starter. > + */ > + ret = submit_bio_wait(&bio); > + if (ret) { > + zram_slot_lock(zram, index); > + zram_clear_flag(zram, index, ZRAM_UNDER_WB); > + zram_slot_unlock(zram, index); > + continue; > + }
Just a thought,
I wonder if it will make sense (and if it will be possible) to writeback idle _compressed_ objects. Right now we decompress, say, a perfectly fine 400-byte compressed object to a PAGE_SIZE-d object and then push it to the WB device. In this particular case it has a x10 bigger IO pressure on flash. If we can write/read compressed object then we will write and read 400-bytes, instead of PAGE_SIZE.
-ss
| |