On Thu, Jan 14, 2021 at 05:59:27PM +0000, Will Deacon wrote: > From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> > > 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@xxxxxxxxxxxxxxx> > [will: s/from from/from/ in comment; spotted by willy] > Signed-off-by: Will Deacon <will@xxxxxxxxxx> > --- > fs/xfs/xfs_file.c | 6 +- > include/linux/mm.h | 12 ++- > include/linux/pgtable.h | 11 +++ > mm/filemap.c | 177 ++++++++++++++++++++++++++--------- > mm/memory.c | 199 ++++++++++++---------------------------- > 5 files changed, 213 insertions(+), 192 deletions(-) > When building microblaze:mmu_defconfig: mm/filemap.c: In function 'filemap_map_pages': mm/filemap.c:3153:3: error: implicit declaration of function 'update_mmu_cache'; did you mean 'update_mmu_tlb'? Bisect log attached. Guenter --- # bad: [a4bfd8d46ac357c12529e4eebb6c89502b03ecc9] Add linux-next specific files for 20210209 # good: [92bf22614b21a2706f4993b278017e437f7785b3] Linux 5.11-rc7 git bisect start 'HEAD' 'v5.11-rc7' # bad: [a8eb921ba7e8e77d994a1c6c69c8ef08456ecf53] Merge remote-tracking branch 'crypto/master' git bisect bad a8eb921ba7e8e77d994a1c6c69c8ef08456ecf53 # bad: [b68df186dae8ae890df08059bb068b78252b053a] Merge remote-tracking branch 'hid/for-next' git bisect bad b68df186dae8ae890df08059bb068b78252b053a # bad: [323c9f6fb99b033883b404ecbc811e7b283a60b3] Merge remote-tracking branch 'sunxi/sunxi/for-next' git bisect bad 323c9f6fb99b033883b404ecbc811e7b283a60b3 # bad: [4053c8a4d3b53205272aa16b65a5b7ed1a3a5b3e] Merge remote-tracking branch 'arm-soc/for-next' git bisect bad 4053c8a4d3b53205272aa16b65a5b7ed1a3a5b3e # good: [dfb8870aed6ad71fb7e378274521bf68a7d465cb] Merge branch 'arm/dt' into for-next git bisect good dfb8870aed6ad71fb7e378274521bf68a7d465cb # good: [9ad7e5a35f96b8bf8aebedfd8f397a64eecb21bd] Merge remote-tracking branch 'arm/for-next' git bisect good 9ad7e5a35f96b8bf8aebedfd8f397a64eecb21bd # good: [edc55d8409542cd05d5c17203615a162cddbcb4c] Merge branch 'arm/drivers' into for-next git bisect good edc55d8409542cd05d5c17203615a162cddbcb4c # good: [d1bbc35fcab28668c8992c4d5777234b794d7306] arm64: hibernate: add __force attribute to gfp_t casting git bisect good d1bbc35fcab28668c8992c4d5777234b794d7306 # bad: [fb01b86f47a44f0c03278a7cc78ece8415898ed0] Merge branches 'for-next/cosmetic', 'for-next/crypto', 'for-next/faultaround', 'for-next/from-tip/irq/urgent', 'for-next/kexec', 'for-next/misc', 'for-next/mm', 'for-next/perf', 'for-next/random', 'for-next/rng', 'for-next/selftests', 'for-next/stacktrace', 'for-next/topology' and 'for-next/vdso' into for-next/core git bisect bad fb01b86f47a44f0c03278a7cc78ece8415898ed0 # good: [750d43b4a79e5f3767ee1db933b42abdf967ce1e] dt-bindings: arm: add Cortex-A78 binding git bisect good 750d43b4a79e5f3767ee1db933b42abdf967ce1e # good: [0188a894c390e51475274ece76b4d601782d709e] arm64: vmlinux.ld.S: add assertion for tramp_pg_dir offset git bisect good 0188a894c390e51475274ece76b4d601782d709e # bad: [3f98a28cc37253269b4104cf95a51f7716a2eb97] mm/nommu: Fix return type of filemap_map_pages() git bisect bad 3f98a28cc37253269b4104cf95a51f7716a2eb97 # bad: [742d33729a0df11c9d8d4625dbf21dd20cdefd44] mm: Move immutable fields of 'struct vm_fault' into anonymous struct git bisect bad 742d33729a0df11c9d8d4625dbf21dd20cdefd44 # bad: [46bdb4277f98e70d0c91f4289897ade533fe9e80] mm: Allow architectures to request 'old' entries when prefaulting git bisect bad 46bdb4277f98e70d0c91f4289897ade533fe9e80 # bad: [f9ce0be71d1fbb038ada15ced83474b0e63f264d] mm: Cleanup faultaround and finish_fault() codepaths git bisect bad f9ce0be71d1fbb038ada15ced83474b0e63f264d # first bad commit: [f9ce0be71d1fbb038ada15ced83474b0e63f264d] mm: Cleanup faultaround and finish_fault() codepaths