public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
* Fwd: Patch for using /proc/<id>oom_score_adj with newer kernels
@ 2011-05-02 23:08 Tony Jones
  2011-05-09 15:18 ` Steve Grubb
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Jones @ 2011-05-02 23:08 UTC (permalink / raw)
  To: linux-audit

I'm not sure what the policy is on moderator approval for posts.  AJ sent this 
a while ago and resent again on 4/27 (he is not subscribed, so both times the
post was waiting moderator approval).  Anyways, we've had this patch in our
OpenSuSE version for a while.

Tony

----- Forwarded message from Andreas Jaeger <aj@novell.com> -----

Date: Wed, 27 Apr 2011 08:43:00 +0200
From: Andreas Jaeger <aj@novell.com>
To: linux-audit@redhat.com
Cc: Tony Jones <tonyj@suse.de>
Subject: Fwd: Patch for using /proc/<id>oom_score_adj with newer kernels
User-Agent: KMail/1.13.7 (Linux/2.6.37.6-0.0.30.67cfac5-desktop; KDE/4.6.2;
	x86_64; ; )

I send the following message some time ago but do not see it in the archives 
and it seems this patch is still needed, so let me resend it,

Andreas
----------  Forwarded Message  ----------

Subject: Patch for using /proc/<id>oom_score_adj with newer kernels
Date: Tuesday, September 28, 2010, 09:25:02
From: Andreas Jaeger <aj@novell.com>
To: linux-audit@redhat.com

Hi,

I see in dmesg on my 2.6.36 kernel:
[   19.424535] auditd (2576): /proc/2576/oom_adj is deprecated, please use 
/proc/2576/oom_score_adj instead.

Since oom_adj is deprecated, let's use oom_score_adj.

Patch appended,

Andreas

From: aj@suse.de
Subject: Use oom_score_adj on newer kernels
Date: 2010-09-27
Signed-Off-by: Andreas Jaeger <aj@suse.de>

I see in dmesg on my 2.6.36 kernel:
[   19.424535] auditd (2576): /proc/2576/oom_adj is deprecated, please use 
/proc/2576/oom_score_adj instead.

Since oom_adj is deprecated, let's use oom_score_adj.

Index: src/auditd.c
===================================================================
--- src/auditd.c.orig
+++ src/auditd.c
@@ -265,7 +265,15 @@ static int write_pid_file(void)
 static void avoid_oom_killer(void)
 {
 	int oomfd;
-	
+
+	/* Newer kernels (noticed in 2.6.36) */
+	oomfd =	open("/proc/self/oom_score_adj", O_NOFOLLOW | O_WRONLY);
+        if (oomfd >= 0) {
+                (void)write(oomfd, "0", 1);
+                close(oomfd);
+                return;
+        }
+	/* Older kernel */
 	oomfd = open("/proc/self/oom_adj", O_NOFOLLOW | O_WRONLY);
 	if (oomfd >= 0) {
 		(void)write(oomfd, "-17", 3);

-- 
 Andreas Jaeger, Program Manager openSUSE,  aj@{novell.com,opensuse.org}
  Twitter: jaegerandi | Identica: jaegerandi
   SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
    Maxfeldstr. 5, 90409 Nürnberg, Germany
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-09 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-02 23:08 Fwd: Patch for using /proc/<id>oom_score_adj with newer kernels Tony Jones
2011-05-09 15:18 ` Steve Grubb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox