Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

zram: rename zram_free_page()

We don't free page in zram_free_page(), not all slots even have any memory
associated with them (e.g. ZRAM_SAME). We free the slot (or reset it),
rename the function accordingly.

Link: https://lkml.kernel.org/r/20251201094754.4149975-6-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Brian Geffon <bgeffon@google.com>
Cc: David Stevens <stevensd@google.com>
Cc: Minchan Kim <minchan@google.com>
Cc: Richard Chang <richardycc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Sergey Senozhatsky and committed by
Andrew Morton
7ad688c0 910bbb44

+10 -10
+10 -10
drivers/block/zram/zram_drv.c
··· 56 56 57 57 static const struct block_device_operations zram_devops; 58 58 59 - static void zram_free_page(struct zram *zram, size_t index); 59 + static void zram_slot_free(struct zram *zram, u32 index); 60 60 #define slot_dep_map(zram, index) (&(zram)->table[(index)].dep_map) 61 61 62 62 static void zram_slot_lock_init(struct zram *zram, u32 index) ··· 984 984 huge = zram_test_flag(zram, index, ZRAM_HUGE); 985 985 } 986 986 987 - zram_free_page(zram, index); 987 + zram_slot_free(zram, index); 988 988 zram_set_flag(zram, index, ZRAM_WB); 989 989 zram_set_handle(zram, index, req->blk_idx); 990 990 ··· 2025 2025 2026 2026 /* Free all pages that are still in this zram device */ 2027 2027 for (index = 0; index < num_pages; index++) 2028 - zram_free_page(zram, index); 2028 + zram_slot_free(zram, index); 2029 2029 2030 2030 zs_destroy_pool(zram->mem_pool); 2031 2031 vfree(zram->table); ··· 2057 2057 return true; 2058 2058 } 2059 2059 2060 - static void zram_free_page(struct zram *zram, size_t index) 2060 + static void zram_slot_free(struct zram *zram, u32 index) 2061 2061 { 2062 2062 unsigned long handle; 2063 2063 ··· 2256 2256 u32 index) 2257 2257 { 2258 2258 zram_slot_lock(zram, index); 2259 - zram_free_page(zram, index); 2259 + zram_slot_free(zram, index); 2260 2260 zram_set_flag(zram, index, ZRAM_SAME); 2261 2261 zram_set_handle(zram, index, fill); 2262 2262 zram_slot_unlock(zram, index); ··· 2294 2294 kunmap_local(src); 2295 2295 2296 2296 zram_slot_lock(zram, index); 2297 - zram_free_page(zram, index); 2297 + zram_slot_free(zram, index); 2298 2298 zram_set_flag(zram, index, ZRAM_HUGE); 2299 2299 zram_set_handle(zram, index, handle); 2300 2300 zram_set_obj_size(zram, index, PAGE_SIZE); ··· 2359 2359 zcomp_stream_put(zstrm); 2360 2360 2361 2361 zram_slot_lock(zram, index); 2362 - zram_free_page(zram, index); 2362 + zram_slot_free(zram, index); 2363 2363 zram_set_handle(zram, index, handle); 2364 2364 zram_set_obj_size(zram, index, comp_len); 2365 2365 zram_slot_unlock(zram, index); ··· 2581 2581 zs_obj_write(zram->mem_pool, handle_new, zstrm->buffer, comp_len_new); 2582 2582 zcomp_stream_put(zstrm); 2583 2583 2584 - zram_free_page(zram, index); 2584 + zram_slot_free(zram, index); 2585 2585 zram_set_handle(zram, index, handle_new); 2586 2586 zram_set_obj_size(zram, index, comp_len_new); 2587 2587 zram_set_priority(zram, index, prio); ··· 2784 2784 2785 2785 while (n >= PAGE_SIZE) { 2786 2786 zram_slot_lock(zram, index); 2787 - zram_free_page(zram, index); 2787 + zram_slot_free(zram, index); 2788 2788 zram_slot_unlock(zram, index); 2789 2789 atomic64_inc(&zram->stats.notify_free); 2790 2790 index++; ··· 2892 2892 return; 2893 2893 } 2894 2894 2895 - zram_free_page(zram, index); 2895 + zram_slot_free(zram, index); 2896 2896 zram_slot_unlock(zram, index); 2897 2897 } 2898 2898