From: Michal Hocko <mhocko@kernel.org>
To: "Адыгжы Ондар" <ondar07@gmail.com>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] mm/oom_kill.c: fix initial value of victim_points variable
Date: Thu, 24 Nov 2016 15:21:00 +0100 [thread overview]
Message-ID: <20161124142100.GA20717@dhcp22.suse.cz> (raw)
In-Reply-To: <CAPhj7_CW_X5UuLPUfUFEA0mfPB_6OSO195ZQokckGOZzJevyyw@mail.gmail.com>
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>
prev parent reply other threads:[~2016-11-24 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 13:11 Адыгжы Ондар
2016-11-24 14:21 ` Michal Hocko [this message]
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=20161124142100.GA20717@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=linux-mm@kvack.org \
--cc=ondar07@gmail.com \
/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