The patch titled Subject: mm/oom_kill.c: introduce is_sysrq_oom helper has been added to the -mm tree. Its filename is mm-oom_kill-introduce-is_sysrq_oom-helper.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-oom_kill-introduce-is_sysrq_oom-helper.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-oom_kill-introduce-is_sysrq_oom-helper.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: Yaowei Bai <bywxiaobai@xxxxxxx> Subject: mm/oom_kill.c: introduce is_sysrq_oom helper Introduce is_sysrq_oom helper function indicating oom kill triggered by sysrq to improve readability. No functional changes. Signed-off-by: Yaowei Bai <bywxiaobai@xxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/oom_kill.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff -puN mm/oom_kill.c~mm-oom_kill-introduce-is_sysrq_oom-helper mm/oom_kill.c --- a/mm/oom_kill.c~mm-oom_kill-introduce-is_sysrq_oom-helper +++ a/mm/oom_kill.c @@ -118,6 +118,15 @@ found: return t; } +/* + * order == -1 means the oom kill is required by sysrq, otherwise only + * for display purposes. + */ +static inline bool is_sysrq_oom(struct oom_control *oc) +{ + return oc->order == -1; +} + /* return true if the task is not adequate as candidate victim task. */ static bool oom_unkillable_task(struct task_struct *p, struct mem_cgroup *memcg, const nodemask_t *nodemask) @@ -265,7 +274,7 @@ enum oom_scan_t oom_scan_process_thread( * Don't allow any other task to have access to the reserves. */ if (test_tsk_thread_flag(task, TIF_MEMDIE)) { - if (oc->order != -1) + if (!is_sysrq_oom(oc)) return OOM_SCAN_ABORT; } if (!task->mm) @@ -278,7 +287,7 @@ enum oom_scan_t oom_scan_process_thread( if (oom_task_origin(task)) return OOM_SCAN_SELECT; - if (task_will_free_mem(task) && oc->order != -1) + if (task_will_free_mem(task) && !is_sysrq_oom(oc)) return OOM_SCAN_ABORT; return OOM_SCAN_OK; @@ -608,7 +617,7 @@ void check_panic_on_oom(struct oom_contr return; } /* Do not panic for oom kills triggered by sysrq */ - if (oc->order == -1) + if (is_sysrq_oom(oc)) return; dump_header(oc, NULL, memcg); panic("Out of memory: %s panic_on_oom is enabled\n", @@ -688,7 +697,7 @@ bool out_of_memory(struct oom_control *o p = select_bad_process(oc, &points, totalpages); /* Found nothing?!?! Either we hang forever, or we panic. */ - if (!p && oc->order != -1) { + if (!p && !is_sysrq_oom(oc)) { dump_header(oc, NULL, NULL); panic("Out of memory and no killable processes...\n"); } _ Patches currently in -mm which might be from bywxiaobai@xxxxxxx are mm-page_alloc-remove-unused-parameter-in-init_currently_empty_zone.patch mm-vmscan-make-inactive_anon_is_low_global-return-directly.patch mm-oom_kill-introduce-is_sysrq_oom-helper.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