FILE *fp;
/* we should reset oomadj value as default because child
- inherits from parent oom_adj*/
- snprintf(buf, MAX_LOCAL_BUFSZ, "/proc/%d/oom_adj", getpid());
+ inherits from parent oom_score_adj*/
+ snprintf(buf, MAX_LOCAL_BUFSZ, "/proc/%d/oom_score_adj", getpid());
fp = fopen(buf, "w");
if (fp == NULL)
return;
- fprintf(fp, "%d", -16);
+ /* Logically, the children processes being launched should be MORE
+ likely to be killed than the launcher and the rest of the OS. So
+ we need to set a high OOM score here */
+ fprintf(fp, "%d", 900);
fclose(fp);
}
+* Mon Jul 23 2012 Brad Peters <brad.t.peters@intel.com> 7730828
+- Updating oom_score setting function to use new systemd interface.
+ Changing child oom_scores from very low (unlikely to be killed) to
+ very high (likely to be killed). This helps us avoid a priority
+ inversion, where OS services are killed off before applications.
+
* Mon Jul 3 2012 Brad Peters <brad.t.peters@intel.com> 7730828
- Adding a build tag