The patch titled Subject: mm, hugetlb: abort __get_user_pages if current has been oom killed has been added to the -mm tree. Its filename is mm-hugetlb-abort-__get_user_pages-if-current-has-been-oom-killed.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-abort-__get_user_pages-if-current-has-been-oom-killed.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-abort-__get_user_pages-if-current-has-been-oom-killed.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/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: David Rientjes <rientjes@xxxxxxxxxx> Subject: mm, hugetlb: abort __get_user_pages if current has been oom killed If __get_user_pages() is faulting a significant number of hugetlb pages, usually as the result of mmap(MAP_LOCKED), it can potentially allocate a very large amount of memory. If the process has been oom killed, this will cause a lot of memory to potentially deplete memory reserves. In the same way that commit 4779280d1ea4 ("mm: make get_user_pages() interruptible") aborted for pending SIGKILLs when faulting non-hugetlb memory, based on the premise of commit 462e00cc7151 ("oom: stop allocating user memory if TIF_MEMDIE is set"), hugetlb page faults now terminate when the process has been oom killed. Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Acked-by: Rik van Riel <riel@xxxxxxxxxx> Acked-by: "Greg Thelen" <gthelen@xxxxxxxxxx> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Acked-by: Davidlohr Bueso <dave@xxxxxxxxxxxx> Acked-by: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff -puN mm/hugetlb.c~mm-hugetlb-abort-__get_user_pages-if-current-has-been-oom-killed mm/hugetlb.c --- a/mm/hugetlb.c~mm-hugetlb-abort-__get_user_pages-if-current-has-been-oom-killed +++ a/mm/hugetlb.c @@ -3278,6 +3278,15 @@ long follow_hugetlb_page(struct mm_struc struct page *page; /* + * If we have a pending SIGKILL, don't keep faulting pages and + * potentially allocating memory. + */ + if (unlikely(fatal_signal_pending(current))) { + remainder = 0; + break; + } + + /* * Some archs (sparc64, sh*) have multiple pte_ts to * each hugepage. We have to make sure we get the * first, for the page indexing below to work. _ Patches currently in -mm which might be from rientjes@xxxxxxxxxx are mm-hugetlb-close-race-when-setting-pagetail-for-gigantic-pages.patch mm-fix-anon_vma-degree-underflow-in-anon_vma-endless-growing-prevention.patch mm-fix-anon_vma-degree-underflow-in-anon_vma-endless-growing-prevention-v2.patch mm-pagewalk-prevent-positive-return-value-of-walk_page_test-from-being-passed-to-callers.patch cxgb4-drop-__gfp_nofail-allocation.patch sh-dwarf-destroy-mempools-on-cleanup.patch sh-dwarf-use-mempool_create_slab_pool.patch jbd2-revert-must-not-fail-allocation-loops-back-to-gfp_nofail.patch mm-slub-parse-slub_debug-o-option-in-switch-statement.patch mm-rename-foll_mlock-to-foll_populate.patch mm-rename-__mlock_vma_pages_range-to-populate_vma_page_range.patch mm-move-gup-posix-mlock-error-conversion-out-of-__mm_populate.patch mm-move-mm_populate-related-code-to-mm-gupc.patch mm-hotplug-fix-concurrent-memory-hot-add-deadlock.patch mm-cma-change-fallback-behaviour-for-cma-freepage.patch mm-page_alloc-factor-out-fallback-freepage-checking.patch mm-compaction-enhance-compaction-finish-condition.patch mm-compaction-enhance-compaction-finish-condition-fix.patch mm-incorporate-zero-pages-into-transparent-huge-pages.patch mm-incorporate-zero-pages-into-transparent-huge-pages-fix.patch mm-completely-remove-dumping-per-cpu-lists-from-show_mem.patch mm-mempolicy-migrate_to_node-should-only-migrate-to-node.patch mm-remove-gfp_thisnode.patch mm-thp-really-limit-transparent-hugepage-allocation-to-local-node.patch kernel-cpuset-remove-exception-for-__gfp_thisnode.patch mm-clarify-__gfp_nofail-deprecation-status.patch mm-clarify-__gfp_nofail-deprecation-status-checkpatch-fixes.patch sparc-clarify-__gfp_nofail-allocation.patch mm-mempool-do-not-allow-atomic-resizing.patch mm-mempool-do-not-allow-atomic-resizing-checkpatch-fixes.patch mm-hugetlb-abort-__get_user_pages-if-current-has-been-oom-killed.patch mm-utilc-add-kstrimdup.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html