diff options
| author | Richard Chang <richardycc@google.com> | 2026-07-28 05:53:33 +0000 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-08-06 18:57:26 -0700 |
| commit | f276408a816790115ccea1f6fcd6b160d80148d8 (patch) | |
| tree | 37ab035afb6b7bd97f66e6339ca884c8313b6f0f /tools/perf/scripts/python | |
| parent | 2f99b6fe0b856065976f569929577fe587bf74b8 (diff) | |
mm/zsmalloc: fix release order of locks in zs_page_migrate()
In zs_page_migrate(), locks are acquired in the following order:
1. write_lock(&pool->lock)
2. spin_lock(&class->lock)
3. zspage_write_trylock(zspage)
However, upon successful page migration, they were being released in
forward acquisition (FIFO) order:
1. write_unlock(&pool->lock)
2. spin_unlock(&class->lock)
3. zspage_write_unlock(zspage)
Fix the unlocking order to release locks in strict reverse (LIFO)
order of acquisition:
3. zspage_write_unlock(zspage)
2. spin_unlock(&class->lock)
1. write_unlock(&pool->lock)
Releasing locks in reverse order of acquisition adheres to standard
kernel locking hygiene, prevents potential lock ordering and lockdep
inconsistencies.
Link: https://lore.kernel.org/20260728055333.421080-1-richardycc@google.com
Signed-off-by: Richard Chang <richardycc@google.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Martin Liu <liumartin@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
