mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Chad Zanonie" <chad.zanonie@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] oom-killer kills more than needed
Date: Mon, 29 Sep 2008 16:09:59 -0700	[thread overview]
Message-ID: <2137b82d0809291609w3a888087j8aec348345a6f076@mail.gmail.com> (raw)

Signed-off-by: Chad Zanonie

This mod firstly replaces a !p->mm check with PF_KTHREAD to more
accurately identify
kthreads. Secondly, it adds a (p->state & TASK_DEAD) check to identify processes
that have released their mm entirely.  Not waiting for a process to finish
releasing its memory entirely can cause the OOM killer to kill another
application unnecessarily (while p->mm is null but memory isn't yet available).


diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 64e5b4b..f325a87 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -216,7 +216,7 @@ static struct task_struct
*select_bad_process(unsigned long *ppoints,
                 * skip kernel threads and tasks which have already released
                 * their mm.
                 */
-               if (!p->mm)
+               if (p->flags & PF_KTHREAD || p->state & TASK_DEAD)
                        continue;
                /* skip the init task */
                if (is_global_init(p))

             reply	other threads:[~2008-09-29 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-29 23:09 Chad Zanonie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-09-19 18:06 Chad Zanonie

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=2137b82d0809291609w3a888087j8aec348345a6f076@mail.gmail.com \
    --to=chad.zanonie@gmail.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®