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

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

 



On Thu 24-11-16 16:11:53, Адыгжы Ондар 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@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;

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[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]