mm: Cleanup faultaround and finish_fault() codepaths
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Sat, 19 Dec 2020 12:19:23 +0000 (15:19 +0300)
committerWill Deacon <will@kernel.org>
Wed, 20 Jan 2021 14:46:04 +0000 (14:46 +0000)
commitf9ce0be71d1fbb038ada15ced83474b0e63f264d
tree81ea4f17081eac47606246a4ba96a43cd8db00c9
parent19c329f6808995b142b3966301f217c831e7cf31
mm: Cleanup faultaround and finish_fault() codepaths

alloc_set_pte() has two users with different requirements: in the
faultaround code, it called from an atomic context and PTE page table
has to be preallocated. finish_fault() can sleep and allocate page table
as needed.

PTL locking rules are also strange, hard to follow and overkill for
finish_fault().

Let's untangle the mess. alloc_set_pte() has gone now. All locking is
explicit.

The price is some code duplication to handle huge pages in faultaround
path, but it should be fine, having overall improvement in readability.

Link: https://lore.kernel.org/r/20201229132819.najtavneutnf7ajp@box
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
[will: s/from from/from/ in comment; spotted by willy]
Signed-off-by: Will Deacon <will@kernel.org>
fs/xfs/xfs_file.c
include/linux/mm.h
include/linux/pgtable.h
mm/filemap.c
mm/memory.c