summaryrefslogtreecommitdiff
path: root/include/linux/init_task.h
diff options
context:
space:
mode:
authorJianyue Wu <wujianyue000@gmail.com>2026-09-06 15:47:19 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-10-08 22:55:04 -0700
commit82e64b8a1bf035a9ce57217ac5c7b64af8c1794f (patch)
tree44dfc8a31588a7285267207abf9dd907ca19b804 /include/linux/init_task.h
parent6ff57b96ab6b471011a6dee5878e4741b70a156f (diff)
mm/zswap: reference the pool by id to shrink struct zswap_entry
struct zswap_entry is one allocation per stored page, so its size is pure overhead. It currently embeds an 8-byte pool pointer, even though the live pools now sit in an allocating xarray keyed by a small integer id that fits in a u8. Replace the per-entry pool pointer with that u8 id and resolve it through the xarray with xa_load(). xa_load() does its own RCU-protected lookup, so the caller needs no rcu_read_lock() section of its own. The resolved pool stays valid because a live entry pins it via percpu_ref (taken in zswap_store_page()), so its id cannot be reused. A live entry never uses the reserved id 0, so a zeroed id resolves to NULL and trips a WARN rather than aliasing a live pool. The u8 fits in the padding after the bool referenced field, shrinking the entry from 56 to 48 bytes on 64-bit. This raises objs_per_slab from 73 to 85 and saves about 2MiB of metadata per 1GiB of data held in zswap. Link: https://lore.kernel.org/20260906-shrink_zswap_entry_v6-v6-3-ac4cf61565fb@gmail.com Signed-off-by: Jianyue Wu <wujianyue000@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Suggested-by: Chris Li <chrisl@kernel.org> Acked-by: Yosry Ahmed <yosry@kernel.org> Cc: Chengming Zhou <chengming.zhou@linux.dev> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Nhat Pham <nphamcs@gmail.com>
Diffstat (limited to 'include/linux/init_task.h')
0 files changed, 0 insertions, 0 deletions