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.

zsmalloc: use all available 24 bits of page_type

Now that we have an extra 8 bits, we don't need to limit ourselves to
supporting a 64KiB page size. I'm sure both Hexagon users are grateful,
but it does reduce complexity a little. We can also remove
reset_first_obj_offset() as calling __ClearPageZsmalloc() will now reset
all 32 bits of page_type.

Link: https://lkml.kernel.org/r/20240821173914.2270383-5-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
04cb7502 4ffca5a9

+6 -20
-1
drivers/block/zram/Kconfig
··· 2 2 config ZRAM 3 3 tristate "Compressed RAM block device support" 4 4 depends on BLOCK && SYSFS && MMU 5 - depends on HAVE_ZSMALLOC 6 5 depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842 7 6 select ZSMALLOC 8 7 help
+2 -8
mm/Kconfig
··· 128 128 choice 129 129 prompt "Default allocator" 130 130 depends on ZSWAP 131 - default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if HAVE_ZSMALLOC 131 + default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if MMU 132 132 default ZSWAP_ZPOOL_DEFAULT_ZBUD 133 133 help 134 134 Selects the default allocator for the compressed cache for ··· 154 154 155 155 config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC 156 156 bool "zsmalloc" 157 - depends on HAVE_ZSMALLOC 158 157 select ZSMALLOC 159 158 help 160 159 Use the zsmalloc allocator as the default allocator. ··· 186 187 page. It is a ZBUD derivative so the simplicity and determinism are 187 188 still there. 188 189 189 - config HAVE_ZSMALLOC 190 - def_bool y 191 - depends on MMU 192 - depends on PAGE_SIZE_LESS_THAN_256KB # we want <= 64 KiB 193 - 194 190 config ZSMALLOC 195 191 tristate 196 192 prompt "N:1 compression allocator (zsmalloc)" if ZSWAP 197 - depends on HAVE_ZSMALLOC 193 + depends on MMU 198 194 help 199 195 zsmalloc is a slab-based memory allocator designed to store 200 196 pages of various compression levels efficiently. It achieves
+4 -11
mm/zsmalloc.c
··· 20 20 * page->index: links together all component pages of a zspage 21 21 * For the huge page, this is always 0, so we use this field 22 22 * to store handle. 23 - * page->page_type: PG_zsmalloc, lower 16 bit locate the first object 23 + * page->page_type: PGTY_zsmalloc, lower 24 bits locate the first object 24 24 * offset in a subpage of a zspage 25 25 * 26 26 * Usage of struct page flags: ··· 452 452 return first_page; 453 453 } 454 454 455 - #define FIRST_OBJ_PAGE_TYPE_MASK 0xffff 456 - 457 - static inline void reset_first_obj_offset(struct page *page) 458 - { 459 - VM_WARN_ON_ONCE(!PageZsmalloc(page)); 460 - page->page_type |= FIRST_OBJ_PAGE_TYPE_MASK; 461 - } 455 + #define FIRST_OBJ_PAGE_TYPE_MASK 0xffffff 462 456 463 457 static inline unsigned int get_first_obj_offset(struct page *page) 464 458 { ··· 462 468 463 469 static inline void set_first_obj_offset(struct page *page, unsigned int offset) 464 470 { 465 - /* With 16 bit available, we can support offsets into 64 KiB pages. */ 466 - BUILD_BUG_ON(PAGE_SIZE > SZ_64K); 471 + /* With 24 bits available, we can support offsets into 16 MiB pages. */ 472 + BUILD_BUG_ON(PAGE_SIZE > SZ_16M); 467 473 VM_WARN_ON_ONCE(!PageZsmalloc(page)); 468 474 VM_WARN_ON_ONCE(offset & ~FIRST_OBJ_PAGE_TYPE_MASK); 469 475 page->page_type &= ~FIRST_OBJ_PAGE_TYPE_MASK; ··· 802 808 ClearPagePrivate(page); 803 809 set_page_private(page, 0); 804 810 page->index = 0; 805 - reset_first_obj_offset(page); 806 811 __ClearPageZsmalloc(page); 807 812 } 808 813