* [PATCH] Add support for oom_score_adj.
@ 2010-08-23 12:35 Luca Tettamanti
2010-08-25 14:51 ` Martin Pitt
0 siblings, 1 reply; 2+ messages in thread
From: Luca Tettamanti @ 2010-08-23 12:35 UTC (permalink / raw)
To: linux-hotplug
/proc/<pid>/oom_adj has been deprecated (kernel v2.6.36) due to the
rework of the badness heuristic; oom_score_adj is the replacement.
Keep a fallback to the old interface for compatibility with older
kernels.
---
udev/udevd.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/udev/udevd.c b/udev/udevd.c
index ad2ca3b..ac2fae0 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -1302,12 +1302,19 @@ int main(int argc, char *argv[])
fclose(f);
}
- /* OOM_DISABLE = -17 */
- fd = open("/proc/self/oom_adj", O_RDWR);
+ fd = open("/proc/self/oom_score_adj", O_RDWR);
if (fd < 0) {
- err(udev, "error disabling OOM: %m\n");
+ /* Fallback to old interface */
+ fd = open("/proc/self/oom_adj", O_RDWR);
+ if (fd < 0) {
+ err(udev, "error disabling OOM: %m\n");
+ } else {
+ /* OOM_DISABLE = -17 */
+ write(fd, "-17", 3);
+ close(fd);
+ }
} else {
- write(fd, "-17", 3);
+ write(fd, "-1000", 5);
close(fd);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Add support for oom_score_adj.
2010-08-23 12:35 [PATCH] Add support for oom_score_adj Luca Tettamanti
@ 2010-08-25 14:51 ` Martin Pitt
0 siblings, 0 replies; 2+ messages in thread
From: Martin Pitt @ 2010-08-25 14:51 UTC (permalink / raw)
To: linux-hotplug
Hello Luca,
Luca Tettamanti [2010-08-23 14:35 +0200]:
> /proc/<pid>/oom_adj has been deprecated (kernel v2.6.36) due to the
> rework of the badness heuristic; oom_score_adj is the replacement.
> Keep a fallback to the old interface for compatibility with older
> kernels.
This corresponds to
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h¦3d83f427fbce97a6cea0db2e64b0eb8435cd10
I pushed that with that reference, thank you!
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-25 14:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-23 12:35 [PATCH] Add support for oom_score_adj Luca Tettamanti
2010-08-25 14:51 ` Martin Pitt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).