Commit 73829b71 authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Andrew Morton

zram: use kmap_local_page()

Use kmap_local_page() instead of kmap_atomic() which has been
deprecated.

Link: https://lkml.kernel.org/r/20231128083845.848008-1-senozhatsky@chromium.orgSigned-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 664dc218
...@@ -1321,9 +1321,9 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page, ...@@ -1321,9 +1321,9 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,
void *mem; void *mem;
value = handle ? zram_get_element(zram, index) : 0; value = handle ? zram_get_element(zram, index) : 0;
mem = kmap_atomic(page); mem = kmap_local_page(page);
zram_fill_page(mem, PAGE_SIZE, value); zram_fill_page(mem, PAGE_SIZE, value);
kunmap_atomic(mem); kunmap_local(mem);
return 0; return 0;
} }
...@@ -1336,14 +1336,14 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page, ...@@ -1336,14 +1336,14 @@ static int zram_read_from_zspool(struct zram *zram, struct page *page,
src = zs_map_object(zram->mem_pool, handle, ZS_MM_RO); src = zs_map_object(zram->mem_pool, handle, ZS_MM_RO);
if (size == PAGE_SIZE) { if (size == PAGE_SIZE) {
dst = kmap_atomic(page); dst = kmap_local_page(page);
memcpy(dst, src, PAGE_SIZE); memcpy(dst, src, PAGE_SIZE);
kunmap_atomic(dst); kunmap_local(dst);
ret = 0; ret = 0;
} else { } else {
dst = kmap_atomic(page); dst = kmap_local_page(page);
ret = zcomp_decompress(zstrm, src, size, dst); ret = zcomp_decompress(zstrm, src, size, dst);
kunmap_atomic(dst); kunmap_local(dst);
zcomp_stream_put(zram->comps[prio]); zcomp_stream_put(zram->comps[prio]);
} }
zs_unmap_object(zram->mem_pool, handle); zs_unmap_object(zram->mem_pool, handle);
...@@ -1416,21 +1416,21 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index) ...@@ -1416,21 +1416,21 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index)
unsigned long element = 0; unsigned long element = 0;
enum zram_pageflags flags = 0; enum zram_pageflags flags = 0;
mem = kmap_atomic(page); mem = kmap_local_page(page);
if (page_same_filled(mem, &element)) { if (page_same_filled(mem, &element)) {
kunmap_atomic(mem); kunmap_local(mem);
/* Free memory associated with this sector now. */ /* Free memory associated with this sector now. */
flags = ZRAM_SAME; flags = ZRAM_SAME;
atomic64_inc(&zram->stats.same_pages); atomic64_inc(&zram->stats.same_pages);
goto out; goto out;
} }
kunmap_atomic(mem); kunmap_local(mem);
compress_again: compress_again:
zstrm = zcomp_stream_get(zram->comps[ZRAM_PRIMARY_COMP]); zstrm = zcomp_stream_get(zram->comps[ZRAM_PRIMARY_COMP]);
src = kmap_atomic(page); src = kmap_local_page(page);
ret = zcomp_compress(zstrm, src, &comp_len); ret = zcomp_compress(zstrm, src, &comp_len);
kunmap_atomic(src); kunmap_local(src);
if (unlikely(ret)) { if (unlikely(ret)) {
zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]); zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]);
...@@ -1494,10 +1494,10 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index) ...@@ -1494,10 +1494,10 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index)
src = zstrm->buffer; src = zstrm->buffer;
if (comp_len == PAGE_SIZE) if (comp_len == PAGE_SIZE)
src = kmap_atomic(page); src = kmap_local_page(page);
memcpy(dst, src, comp_len); memcpy(dst, src, comp_len);
if (comp_len == PAGE_SIZE) if (comp_len == PAGE_SIZE)
kunmap_atomic(src); kunmap_local(src);
zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]); zcomp_stream_put(zram->comps[ZRAM_PRIMARY_COMP]);
zs_unmap_object(zram->mem_pool, handle); zs_unmap_object(zram->mem_pool, handle);
...@@ -1614,9 +1614,9 @@ static int zram_recompress(struct zram *zram, u32 index, struct page *page, ...@@ -1614,9 +1614,9 @@ static int zram_recompress(struct zram *zram, u32 index, struct page *page,
num_recomps++; num_recomps++;
zstrm = zcomp_stream_get(zram->comps[prio]); zstrm = zcomp_stream_get(zram->comps[prio]);
src = kmap_atomic(page); src = kmap_local_page(page);
ret = zcomp_compress(zstrm, src, &comp_len_new); ret = zcomp_compress(zstrm, src, &comp_len_new);
kunmap_atomic(src); kunmap_local(src);
if (ret) { if (ret) {
zcomp_stream_put(zram->comps[prio]); zcomp_stream_put(zram->comps[prio]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment