The patch titled Subject: zram: don't use highmem for the bounce buffer in zram_bvec_{read,write} has been added to the -mm mm-unstable branch. Its filename is zram-dont-use-highmem-for-the-bounce-buffer-in-zram_bvec_readwrite.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-dont-use-highmem-for-the-bounce-buffer-in-zram_bvec_readwrite.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Christoph Hellwig <hch@xxxxxx> Subject: zram: don't use highmem for the bounce buffer in zram_bvec_{read,write} Date: Tue, 11 Apr 2023 19:14:50 +0200 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@xxxxxx Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> Acked-by: Minchan Kim <minchan@xxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/block/zram/zram_drv.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) --- a/drivers/block/zram/zram_drv.c~zram-dont-use-highmem-for-the-bounce-buffer-in-zram_bvec_readwrite +++ a/drivers/block/zram/zram_drv.c @@ -1431,7 +1431,7 @@ static int zram_bvec_read(struct zram *z 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 *z 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 * 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 * 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); } _ Patches currently in -mm which might be from hch@xxxxxx are zram-always-compile-read_from_bdev_sync.patch zram-remove-valid_io_request.patch zram-make-zram_bio_discard-more-self-contained.patch zram-simplify-bvec-iteration-in-__zram_make_request.patch zram-move-discard-handling-to-zram_submit_bio.patch zram-return-early-on-error-in-zram_bvec_rw.patch zram-refactor-highlevel-read-and-write-handling.patch zram-dont-use-highmem-for-the-bounce-buffer-in-zram_bvec_readwrite.patch zram-rename-__zram_bvec_read-to-zram_read_page.patch zram-directly-call-zram_read_page-in-writeback_store.patch zram-refactor-zram_bdev_read.patch zram-dont-pass-a-bvec-to-__zram_bvec_write.patch zram-refactor-zram_bdev_write.patch zram-pass-a-page-to-read_from_bdev.patch zram-dont-return-errors-from-read_from_bdev_async.patch zram-fix-synchronous-reads.patch zram-return-errors-from-read_from_bdev_sync.patch