]> Git Repo - linux.git/commit - mm/memory.c
mm: fix the deadlock in finish_fault()
authorQi Zheng <[email protected]>
Fri, 23 Jul 2021 22:50:41 +0000 (15:50 -0700)
committerLinus Torvalds <[email protected]>
Sat, 24 Jul 2021 00:43:28 +0000 (17:43 -0700)
commite4dc3489143f84f7ed30be58b886bb6772f229b9
tree5a51b8b8bddd6a5b522f1acf792e62173f47669c
parente904c2ccf9b5cb356eec754ffea05c08984f6535
mm: fix the deadlock in finish_fault()

Commit 63f3655f9501 ("mm, memcg: fix reclaim deadlock with writeback")
fix the following ABBA deadlock by pre-allocating the pte page table
without holding the page lock.

                                lock_page(A)
                                        SetPageWriteback(A)
                                        unlock_page(A)
  lock_page(B)
                                        lock_page(B)
  pte_alloc_one
    shrink_page_list
      wait_on_page_writeback(A)
                                        SetPageWriteback(B)
                                        unlock_page(B)

                                        # flush A, B to clear the writeback

Commit f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault()
codepaths") reworked the relevant code but ignored this race.  This will
cause the deadlock above to appear again, so fix it.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: f9ce0be71d1f ("mm: Cleanup faultaround and finish_fault() codepaths")
Signed-off-by: Qi Zheng <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memory.c
This page took 0.049051 seconds and 4 git commands to generate.