zsmalloc: backport from 5994eabf3bbb

Backport zsmalloc from commit 5994eabf3bbb ("merge mm-hotfixes-stable into
mm-stable to pick up depended-upon changes").

Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
This commit is contained in:
Juhyung Park 2023-09-26 02:15:49 +09:00 committed by Ksawlii
parent e9933557cb
commit cfd1b6ca17
3 changed files with 500 additions and 651 deletions

View file

@ -55,5 +55,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle);
unsigned long zs_get_total_pages(struct zs_pool *pool); unsigned long zs_get_total_pages(struct zs_pool *pool);
unsigned long zs_compact(struct zs_pool *pool); unsigned long zs_compact(struct zs_pool *pool);
unsigned int zs_lookup_class_index(struct zs_pool *pool, unsigned int size);
void zs_pool_stats(struct zs_pool *pool, struct zs_pool_stats *stats); void zs_pool_stats(struct zs_pool *pool, struct zs_pool_stats *stats);
#endif #endif

View file

@ -708,15 +708,12 @@ config Z3FOLD
still there. still there.
config ZSMALLOC config ZSMALLOC
tristate "Memory allocator for compressed pages" tristate "N:1 compression allocator (zsmalloc)"
depends on MMU depends on MMU
help help
zsmalloc is a slab-based memory allocator designed to store zsmalloc is a slab-based memory allocator designed to store
compressed RAM pages. zsmalloc uses virtual memory mapping pages of various compression levels efficiently. It achieves
in order to reduce fragmentation. However, this results in a the highest storage density with the least amount of fragmentation.
non-standard allocator interface where a handle, not a pointer, is
returned by an alloc(). This handle must be mapped in order to
access the allocated space.
config ZSMALLOC_STAT config ZSMALLOC_STAT
bool "Export zsmalloc statistics" bool "Export zsmalloc statistics"
@ -724,10 +721,29 @@ config ZSMALLOC_STAT
select DEBUG_FS select DEBUG_FS
help help
This option enables code in the zsmalloc to collect various This option enables code in the zsmalloc to collect various
statistics about whats happening in zsmalloc and exports that statistics about what's happening in zsmalloc and exports that
information to userspace via debugfs. information to userspace via debugfs.
If unsure, say N. If unsure, say N.
config ZSMALLOC_CHAIN_SIZE
int "Maximum number of physical pages per-zspage"
default 8
range 4 16
depends on ZSMALLOC
help
This option sets the upper limit on the number of physical pages
that a zmalloc page (zspage) can consist of. The optimal zspage
chain size is calculated for each size class during the
initialization of the pool.
Changing this option can alter the characteristics of size classes,
such as the number of pages per zspage and the number of objects
per zspage. This can also result in different configurations of
the pool, as zsmalloc merges size classes with similar
characteristics.
For more information, see zsmalloc documentation.
config GENERIC_EARLY_IOREMAP config GENERIC_EARLY_IOREMAP
bool bool

File diff suppressed because it is too large Load diff