[PATCH] mm/oom_kill.c: fix initial value of victim_points variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

------------------------------------------------------------------------------------
--- 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;

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]