The patch titled Subject: mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races-fix has been added to the -mm tree. Its filename is mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races-fix.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races-fix.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races-fix make mf_mutex local to memory_failure() Cc: Aili Yao <yaoaili@xxxxxxxxxxxx> Cc: Andy Lutomirski <luto@xxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Jue Wang <juew@xxxxxxxxxx> Cc: Naoya Horiguchi <naoya.horiguchi@xxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory-failure.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/memory-failure.c~mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races-fix +++ a/mm/memory-failure.c @@ -1397,8 +1397,6 @@ out: return rc; } -static DEFINE_MUTEX(mf_mutex); - /** * memory_failure - Handle memory failure of a page. * @pfn: Page Number of the corrupted page @@ -1425,6 +1423,7 @@ int memory_failure(unsigned long pfn, in int res = 0; unsigned long page_flags; bool retry = true; + static DEFINE_MUTEX(mf_mutex); if (!sysctl_memory_failure_recovery) panic("Memory failure on page %lx", pfn); _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are mm.patch mm-slub-kunit-add-a-kunit-test-for-slub-debugging-functionality-fix-2.patch mm-gup-pack-has_pinned-in-mmf_has_pinned-checkpatch-fixes.patch mm-memcg-optimize-user-context-object-stock-access-checkpatch-fixes.patch mm-memcg-slab-create-a-new-set-of-kmalloc-cg-n-caches-v5-fix.patch binfmt-remove-in-tree-usage-of-map_executable-fix.patch mm-mmap-introduce-unlock_range-for-code-cleanup-fix.patch powerpc-mm-book3s64-update-tlb-flush-routines-to-take-a-page-walk-cache-flush-argument-fix.patch mm-mremap-use-range-flush-that-does-tlb-and-page-walk-cache-flush-fix.patch mm-memory-failure-use-a-mutex-to-avoid-memory_failure-races-fix.patch mm-memory_hotplug-disable-memmap_on_memory-when-hugetlb_free_vmemmap-enabled-fix.patch mm-thp-check-total_mapcount-instead-of-page_mapcount-fix-fix.patch nommu-remove-__gfp_highmem-in-vmalloc-vzalloc-checkpatch-fixes.patch mm-madvise-introduce-madv_populate_readwrite-to-prefault-page-tables-checkpatch-fixes.patch kernelh-split-out-panic-and-oops-helpers-fix.patch lib-decompressors-remove-set-but-not-used-variabled-level-fix.patch linux-next-git-rejects.patch mm-introduce-memfd_secret-system-call-to-create-secret-memory-areas-fix.patch module-add-printk-formats-to-add-module-build-id-to-stacktraces-fix.patch kernel-forkc-export-kernel_thread-to-modules.patch