Allow users to increase the oom score of their applications.
Signed-off-by: Bodo Eggert <[email protected]>
---
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]