From: Michal Hocko <mhocko@suse.com>
To: Peng Zhang <zhangpeng362@huawei.com>
Cc: linux-mm@kvack.org, shakeelb@google.com,
akpm@linux-foundation.org, wangkefeng.wang@huawei.com,
sunnanyong@huawei.com
Subject: Re: [PATCH 1/2] mm: oom: remove unnecessary goto in oom_evaluate_task()
Date: Wed, 16 Aug 2023 08:46:41 +0200 [thread overview]
Message-ID: <ZNxw0XXw2i+YHHJy@dhcp22.suse.cz> (raw)
In-Reply-To: <20230814063428.4111206-2-zhangpeng362@huawei.com>
On Mon 14-08-23 14:34:27, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@huawei.com>
>
> Remove redundant goto statement in oom_evaluate_task() to simplify the
> code a bit. No functional modification involved.
Quite honestly, I do not see much point in changing the code this way.
We still have other goto labels and also there are other changes
happening where this label could be still benefitial [1]
[1] http://lkml.kernel.org/r/20230810081319.65668-2-zhouchuyi@bytedance.com
>
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
> ---
> mm/oom_kill.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 44bde56ecd02..10f7826c4035 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -335,14 +335,12 @@ static int oom_evaluate_task(struct task_struct *task, void *arg)
> */
> if (oom_task_origin(task)) {
> points = LONG_MAX;
> - goto select;
> + } else {
> + points = oom_badness(task, oc->totalpages);
> + if (points == LONG_MIN || points < oc->chosen_points)
> + goto next;
> }
>
> - points = oom_badness(task, oc->totalpages);
> - if (points == LONG_MIN || points < oc->chosen_points)
> - goto next;
> -
> -select:
> if (oc->chosen)
> put_task_struct(oc->chosen);
> get_task_struct(task);
> --
> 2.25.1
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2023-08-16 6:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-14 6:34 [PATCH 0/2] mm: oom: terminate the oom_evaluate_task() loop early Peng Zhang
2023-08-14 6:34 ` [PATCH 1/2] mm: oom: remove unnecessary goto in oom_evaluate_task() Peng Zhang
2023-08-16 6:46 ` Michal Hocko [this message]
2023-08-16 8:56 ` zhangpeng (AS)
2023-08-14 6:34 ` [PATCH 2/2] mm: oom: terminate the oom_evaluate_task() loop early Peng Zhang
2023-08-16 6:48 ` Michal Hocko
2023-08-16 8:57 ` zhangpeng (AS)
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=ZNxw0XXw2i+YHHJy@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=shakeelb@google.com \
--cc=sunnanyong@huawei.com \
--cc=wangkefeng.wang@huawei.com \
--cc=zhangpeng362@huawei.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