mm/zsmalloc: remove migrate_write_lock_nested()
authorChengming Zhou <zhouchengming@bytedance.com>
Mon, 19 Feb 2024 13:33:52 +0000 (13:33 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 24 Feb 2024 01:48:30 +0000 (17:48 -0800)
commit59def443c9942545a9bc702d8a42babc615a8d97
tree02f0cd39750f39448fb51e2440d7fcb9f660514f
parent568b567f78acbe64d2e91b7e58a85feb6846434c
mm/zsmalloc: remove migrate_write_lock_nested()

The migrate write lock is to protect the race between zspage migration and
zspage objects' map users.

We only need to lock out the map users of src zspage, not dst zspage,
which is safe to map by users concurrently, since we only need to do
obj_malloc() from dst zspage.

So we can remove the migrate_write_lock_nested() use case.

As we are here, cleanup the __zs_compact() by moving putback_zspage()
outside of migrate_write_unlock since we hold pool lock, no malloc or free
users can come in.

Link: https://lkml.kernel.org/r/20240219-b4-szmalloc-migrate-v1-2-34cd49c6545b@bytedance.com
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/zsmalloc.c