Messages in this thread Patch in this message | | | Date | Fri, 7 Jul 2006 12:41:40 +0200 (CEST) | From | Bodo Eggert <> | Subject | [RFC][PATCH] allow users to increase the oom-killer-score of their applications |
| |
Allow users to increase the oom score of their applications.
Signed-off-by: Bodo Eggert <7eggert@gmx.de>
---
This patch is tested by "in the editor, it looks good".
There is a small race possibly preventing root from changing the score, but I don't think it's an issue, since kill -9 exisis and the race is tiny.
--- ./fs/proc/base.c~ 2006-07-07 12:20:54.000000000 +0200 +++ ./fs/proc/base.c 2006-07-07 12:20:54.000000000 +0200 @@ -962,8 +962,6 @@ static ssize_t oom_adjust_write(struct f char buffer[8], *end; int oom_adjust; - if (!capable(CAP_SYS_RESOURCE)) - return -EPERM; memset(buffer, 0, 8); if (count > 6) count = 6; @@ -974,6 +972,9 @@ static ssize_t oom_adjust_write(struct f return -EINVAL; if (*end == '\n') end++; + if (!capable(CAP_SYS_RESOURCE) + && task->oomkilladj > oom_adjust) + return -EPERM; task->oomkilladj = oom_adjust; if (end - buffer == 0) return -EIO; -- Funny quotes: 20. The only substitute for good manners is fast reflexes. - 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/
| |