Skip to contentSkip to conversation

mm/oom_kill: Insert newline for better readability

PATCH In review Nyunwoo Kim 2 participants 2 messages Apr 30

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/oom_kill: Insert newline for better readability

Insert a newline in check_panic_on_oom() for better readability.

---
This is my first patch and I am using it as practice to learn kernel development. If this has wasted your time, I apologize; it was unintentional. Thank you for your consideration.

 mm/oom_kill.c | 3 +++
 1 file changed, 3 insertions(+)
mm/oom_kill.c +3 -0
index 5c6c95c169ee..86a08deaa697 100644
@@ -1076,6 +1076,7 @@ static void check_panic_on_oom(struct oom_control *oc)
 {
 	if (likely(!sysctl_panic_on_oom))
 		return;
+
 	if (sysctl_panic_on_oom != 2) {
 		/*
 		 * panic_on_oom == 1 only affects CONSTRAINT_NONE, the kernel
@@ -1085,9 +1086,11 @@ static void check_panic_on_oom(struct oom_control *oc)
 		if (oc->constraint != CONSTRAINT_NONE)
 			return;
 	}
+
 	/* Do not panic for oom kills triggered by sysrq */
 	if (is_sysrq_oom(oc))
 		return;
+
 	dump_header(oc);
 	panic("Out of memory: %s panic_on_oom is enabled\n",
 		sysctl_panic_on_oom == 2 ? "compulsory" : "system-wide");
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 7 lines · Nyunwoo Kim

Insert a newline in check_panic_on_oom() for better readability.

---
This is my first patch and I am using it as practice to learn kernel development. If this has wasted your time, I apologize; it was unintentional. Thank you for your consideration.

Patches like this are not adding any real value. While aiming for a better readable code is a nobel goal I would recommend adding clean ups like this one to other changes/patches that are improving the code (either fixing existing bugs or making the overall code much better).

Thanks for trying and keep looking for something that might improve the code.

Quoted 30 lines
 mm/oom_kill.c | 3 +++
 1 file changed, 3 insertions(+)
mm/oom_kill.c +3 -0
index 5c6c95c169ee..86a08deaa697 100644
@@ -1076,6 +1076,7 @@ static void check_panic_on_oom(struct oom_control *oc)
 {
 	if (likely(!sysctl_panic_on_oom))
 		return;
+
 	if (sysctl_panic_on_oom != 2) {
 		/*
 		 * panic_on_oom == 1 only affects CONSTRAINT_NONE, the kernel
@@ -1085,9 +1086,11 @@ static void check_panic_on_oom(struct oom_control *oc)
 		if (oc->constraint != CONSTRAINT_NONE)
 			return;
 	}
+
 	/* Do not panic for oom kills triggered by sysrq */
 	if (is_sysrq_oom(oc))
 		return;
+
 	dump_header(oc);
 	panic("Out of memory: %s panic_on_oom is enabled\n",
 		sysctl_panic_on_oom == 2 ? "compulsory" : "system-wide");
Signature · 1 line
2.25.1
Signature · 2 lines
Michal Hocko
SUSE Labs