diff options
author | Christoph Hellwig <hch@lst.de> | 2023-04-11 19:14:50 +0200 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-04-18 16:29:58 -0700 |
commit | f575a5add8a9a3ca593e58e218f2113e5bd3e50e (patch) | |
tree | 9ae01779e3f172834c738de30d44582ce0d6214b /drivers/block | |
parent | 82ca875d2549f6843d0d16e897c9e1e0a13c8a74 (diff) |
zram: don't use highmem for the bounce buffer in zram_bvec_{read,write}
There is no point in allocation a highmem page when we instantly need to
copy from it.
Link: https://lkml.kernel.org/r/20230411171459.567614-9-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/zram/zram_drv.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 2d0154489f03..0182316b2a90 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1431,7 +1431,7 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, page = bvec->bv_page; if (is_partial_io(bvec)) { /* Use a temporary buffer to decompress the page */ - page = alloc_page(GFP_NOIO|__GFP_HIGHMEM); + page = alloc_page(GFP_NOIO); if (!page) return -ENOMEM; } @@ -1440,12 +1440,8 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec, if (unlikely(ret)) goto out; - if (is_partial_io(bvec)) { - void *src = kmap_atomic(page); - - memcpy_to_bvec(bvec, src + offset); - kunmap_atomic(src); - } + if (is_partial_io(bvec)) + memcpy_to_bvec(bvec, page_address(page) + offset); out: if (is_partial_io(bvec)) __free_page(page); @@ -1589,12 +1585,11 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, vec = *bvec; if (is_partial_io(bvec)) { - void *dst; /* * This is a partial IO. We need to read the full page * before to write the changes. */ - page = alloc_page(GFP_NOIO|__GFP_HIGHMEM); + page = alloc_page(GFP_NOIO); if (!page) return -ENOMEM; @@ -1602,9 +1597,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, if (ret) goto out; - dst = kmap_atomic(page); - memcpy_from_bvec(dst + offset, bvec); - kunmap_atomic(dst); + memcpy_from_bvec(page_address(page) + offset, bvec); bvec_set_page(&vec, page, PAGE_SIZE, 0); } |