From: Dave Jones <davej@redhat.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Hugh Dickins <hughd@google.com>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
David Rientjes <rientjes@google.com>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Anton Arapov <anton@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
linux-kernel@vger.kernel.org
Subject: Re: oom-killer is crazy? (Was: [PATCH 0/3] uprobes fixes for 3.5)
Date: Fri, 8 Jun 2012 10:26:25 -0400 [thread overview]
Message-ID: <20120608142625.GC1711@redhat.com> (raw)
In-Reply-To: <20120608140328.GA26650@redhat.com>
On Fri, Jun 08, 2012 at 04:03:28PM +0200, Oleg Nesterov wrote:
> On 06/07, Oleg Nesterov wrote:
> >
> > This doesn't depend on other uprobes patches I sent, and I think
> > this is 3.5 material.
>
> And during the testing I found another thing which should be fixed
> in 3.5 imho. I noticed that oom-killer goes crazy. In the simplest
> case, when there is the single and "obvious" memory hog it kills
> sshd daemon.
>
> Hmm. oom_badness() does
>
> if (has_capability_noaudit(p, CAP_SYS_ADMIN))
> points -= 30 * totalpages / 1000;
>
> very nice, but what if this underflows? points is unsigned long.
> points += p->signal->oom_score_adj... looks suspicious too.
>
> Looks like we should remove "unsigned" from oom_badness() and
> its callers? Probably not, it does "return points ? points : 1".
I've been running this from David for a week, but it still isn't right..
Dave
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index ed0e196..416637f 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -183,7 +183,7 @@ static bool oom_unkillable_task(struct task_struct *p,
unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
const nodemask_t *nodemask, unsigned long totalpages)
{
- unsigned long points;
+ long points;
if (oom_unkillable_task(p, memcg, nodemask))
return 0;
@@ -223,7 +223,7 @@ unsigned long oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
* Never return 0 for an eligible task regardless of the root bonus and
* oom_score_adj (oom_score_adj can't be OOM_SCORE_ADJ_MIN here).
*/
- return points ? points : 1;
+ return points > 0 ? points : 1;
}
/*
next prev parent reply other threads:[~2012-06-08 14:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 16:59 [PATCH 0/3] uprobes fixes for 3.5 Oleg Nesterov
2012-06-07 17:00 ` [PATCH 1/3] uprobes: valid_vma() should reject VM_HUGETLB Oleg Nesterov
2012-06-15 6:22 ` Srikar Dronamraju
2012-06-07 17:00 ` [PATCH 2/3] uprobes: __copy_insn() should ensure a_ops->readpage != NULL Oleg Nesterov
2012-06-15 6:25 ` Srikar Dronamraju
2012-06-15 12:10 ` Ingo Molnar
2012-06-07 17:00 ` [PATCH 3/3] uprobes: write_opcode()->__replace_page() can race with try_to_unmap() Oleg Nesterov
2012-06-08 8:47 ` Peter Zijlstra
2012-06-08 10:03 ` Oleg Nesterov
2012-06-08 16:55 ` Oleg Nesterov
2012-06-15 6:12 ` Srikar Dronamraju
2012-06-15 12:11 ` Ingo Molnar
2012-06-15 15:48 ` Oleg Nesterov
2012-06-16 7:11 ` Ingo Molnar
2012-06-08 14:03 ` oom-killer is crazy? (Was: [PATCH 0/3] uprobes fixes for 3.5) Oleg Nesterov
2012-06-08 14:26 ` Dave Jones [this message]
2012-06-08 15:04 ` Oleg Nesterov
2012-06-08 20:21 ` [patch for-3.5-rc1] mm, oom: fix badness score underflow David Rientjes
2012-06-09 22:25 ` KOSAKI Motohiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120608142625.GC1711@redhat.com \
--to=davej@redhat.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=hughd@google.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rientjes@google.com \
--cc=srikar@linux.vnet.ibm.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome