linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Адыгжы Ондар" <ondar07@gmail.com>
To: linux-mm@kvack.org
Subject: [PATCH] mm/oom_kill.c: fix initial value of victim_points variable
Date: Thu, 24 Nov 2016 16:11:53 +0300	[thread overview]
Message-ID: <CAPhj7_CW_X5UuLPUfUFEA0mfPB_6OSO195ZQokckGOZzJevyyw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

If the initial value of victim_points variable is equal to 0,
oom killer may choose a victim incorrectly.
For example, parent points > 0, 0 < child_points < parent points
(chosen_points).
In this example, current oom killer chooses this child, not parent.

To apply the patch, in the root of a kernel tree use:
patch -p1 <this_fix.patch

Signed-off-by: Adygzhy Ondar <ondar07@gmail.com>

------------------------------------------------------------------------------------
--- linux/mm/oom_kill.c.orig 2016-11-24 15:03:43.711235386 +0300
+++ linux/mm/oom_kill.c 2016-11-24 15:04:00.851942474 +0300
@@ -812,7 +812,7 @@ static void oom_kill_process(struct oom_
  struct task_struct *child;
  struct task_struct *t;
  struct mm_struct *mm;
- unsigned int victim_points = 0;
+ unsigned int victim_points = points;
  static DEFINE_RATELIMIT_STATE(oom_rs, DEFAULT_RATELIMIT_INTERVAL,
       DEFAULT_RATELIMIT_BURST);
  bool can_oom_reap = true;

[-- Attachment #2: Type: text/html, Size: 1904 bytes --]

             reply	other threads:[~2016-11-24 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24 13:11 Адыгжы Ондар [this message]
2016-11-24 14:21 ` Michal Hocko

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=CAPhj7_CW_X5UuLPUfUFEA0mfPB_6OSO195ZQokckGOZzJevyyw@mail.gmail.com \
    --to=ondar07@gmail.com \
    --cc=linux-mm@kvack.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