Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1226039 > unrolled thread
| Started by | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| First post | 2015-09-16 14:20 +0200 |
| Last post | 2015-09-22 01:10 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/3] mm/oom_kill: introduce is_sysrq_oom helper Yaowei Bai <bywxiaobai@163.com> - 2015-09-16 14:20 +0200
Re: [PATCH 2/3] mm/oom_kill: introduce is_sysrq_oom helper Michal Hocko <mhocko@kernel.org> - 2015-09-21 18:20 +0200
Re: [PATCH 2/3] mm/oom_kill: introduce is_sysrq_oom helper David Rientjes <rientjes@google.com> - 2015-09-22 01:10 +0200
| From | Yaowei Bai <bywxiaobai@163.com> |
|---|---|
| Date | 2015-09-16 14:20 +0200 |
| Subject | [PATCH 2/3] mm/oom_kill: introduce is_sysrq_oom helper |
| Message-ID | <q9jQR-4b3-1@gated-at.bofh.it> |
Introduce is_sysrq_oom helper function indicating oom kill triggered
by sysrq to improve readability.
No functional changes.
Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
mm/oom_kill.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 1ecc0bc..7b6228e 100644
--- a/mm/oom_kill.c
+++ b/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(struct oom_control *oc,
* 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(struct oom_control *oc,
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_control *oc, enum oom_constraint constraint,
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 *oc)
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");
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Date | 2015-09-21 18:20 +0200 |
| Message-ID | <qbbYS-3k6-3@gated-at.bofh.it> |
| In reply to | #1226039 |
On Wed 16-09-15 19:59:59, Yaowei Bai wrote:
> Introduce is_sysrq_oom helper function indicating oom kill triggered
> by sysrq to improve readability.
>
> No functional changes.
I was complaining about a subtle semantic of order -1 when it was
introduced. This is easier to follow. At least for me.
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> mm/oom_kill.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 1ecc0bc..7b6228e 100644
> --- a/mm/oom_kill.c
> +++ b/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(struct oom_control *oc,
> * 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(struct oom_control *oc,
> 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_control *oc, enum oom_constraint constraint,
> 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 *oc)
>
> 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");
> }
> --
> 1.9.1
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Date | 2015-09-22 01:10 +0200 |
| Message-ID | <qbinD-4dy-21@gated-at.bofh.it> |
| In reply to | #1226039 |
On Wed, 16 Sep 2015, Yaowei Bai wrote: > Introduce is_sysrq_oom helper function indicating oom kill triggered > by sysrq to improve readability. > > No functional changes. > > Signed-off-by: Yaowei Bai <bywxiaobai@163.com> Acked-by: David Rientjes <rientjes@google.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web