* [PATCH] mm/oom_kill.c: fix initial value of victim_points variable
@ 2016-11-24 13:11 Адыгжы Ондар
2016-11-24 14:21 ` Michal Hocko
0 siblings, 1 reply; 2+ messages in thread
From: Адыгжы Ондар @ 2016-11-24 13:11 UTC (permalink / raw)
To: linux-mm
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/oom_kill.c: fix initial value of victim_points variable
2016-11-24 13:11 [PATCH] mm/oom_kill.c: fix initial value of victim_points variable Адыгжы Ондар
@ 2016-11-24 14:21 ` Michal Hocko
0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2016-11-24 14:21 UTC (permalink / raw)
To: Адыгжы
Ондар
Cc: linux-mm
On Thu 24-11-16 16:11:53, D?D'N?D3D?N? D?D 1/2 D'D?N? wrote:
> 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.
Which is how the code is supposed to work. We do sacrifice child to save
work done by the parent. So the main point here is to choose the largest
child (if any) of the selected victim. If you think about that any
"child" with points > selected_victim shouldn't be possible because it
would have been child to be selected.
So NAK to this.
> 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;
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-24 14:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-24 13:11 [PATCH] mm/oom_kill.c: fix initial value of victim_points variable Адыгжы Ондар
2016-11-24 14:21 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox