diff options
| author | andrew.yang <[email protected]> | 2022-03-22 14:46:08 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2022-03-22 15:57:09 -0700 |
| commit | 356ea3865687926e5da7579d1f3351d3f0a322a1 (patch) | |
| tree | e5f2593aa9013ea269204b789fb3a8fd5bf625d7 /tools/perf/scripts/python | |
| parent | fc89213a636c3735eb3386f10a34c082271b4192 (diff) | |
mm/migrate: fix race between lock page and clear PG_Isolated
When memory is tight, system may start to compact memory for large
continuous memory demands. If one process tries to lock a memory page
that is being locked and isolated for compaction, it may wait a long time
or even forever. This is because compaction will perform non-atomic
PG_Isolated clear while holding page lock, this may overwrite PG_waiters
set by the process that can't obtain the page lock and add itself to the
waiting queue to wait for the lock to be unlocked.
CPU1 CPU2
lock_page(page); (successful)
lock_page(); (failed)
__ClearPageIsolated(page); SetPageWaiters(page) (may be overwritten)
unlock_page(page);
The solution is to not perform non-atomic operation on page flags while
holding page lock.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: andrew.yang <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: "Vlastimil Babka" <[email protected]>
Cc: David Howells <[email protected]>
Cc: "William Kucharski" <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Yang Shi <[email protected]>
Cc: Marc Zyngier <[email protected]>
Cc: Nicholas Tang <[email protected]>
Cc: Kuan-Ying Lee <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions