From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E72A9C433F5 for ; Wed, 1 Jun 2022 07:45:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E83CD6B007D; Wed, 1 Jun 2022 03:45:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E10076B007E; Wed, 1 Jun 2022 03:45:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD5706B0080; Wed, 1 Jun 2022 03:45:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BA2236B007D for ; Wed, 1 Jun 2022 03:45:29 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 6A97334D53 for ; Wed, 1 Jun 2022 07:45:29 +0000 (UTC) X-FDA: 79528881978.22.D0C7B54 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf19.hostedemail.com (Postfix) with ESMTP id C99491A0056 for ; Wed, 1 Jun 2022 07:45:13 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5C30021A9B; Wed, 1 Jun 2022 07:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1654069527; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=c+kKVH4gdDZYbxjzcOg+jvGZrV/KqgQJdzEt6yLtxiw=; b=S4LQzg4KaKuueGjKKTJTztLQBLTVTM/c3TROtrfcIiBWV1r0FZshxfMF8/d5hLWUwKxQ/T VoY7CuPuR1DTfo6SjQ9XqCX6B9b7Yce7+pfomnSKgOshcw/3dIrbIJ9zsrHIYWSDWeDyWn K0rMKoc/3Et8Cd5W6tATzOYhsy7r6Ao= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 1FF002C141; Wed, 1 Jun 2022 07:45:27 +0000 (UTC) Date: Wed, 1 Jun 2022 09:45:26 +0200 From: Michal Hocko To: Zhaoyu Liu Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/oom_kill: break evaluation when a task has been selected Message-ID: References: <20220514075223.GA11384@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220514075223.GA11384@pc> X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C99491A0056 X-Stat-Signature: 447ny1hgihfbk49crqytdefwqxdgzrsi X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=S4LQzg4K; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-HE-Tag: 1654069513-596464 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat 14-05-22 15:52:28, Zhaoyu Liu wrote: > oom points no longer need to be calculated if a task is oom_task_origin(), > so return 1 to stop the oom_evaluate_task(). This doesn't really explain why this is really desired. Is this a fix, optimization? Please also note that this change has some side effects. For one, the task marked as oom origin will get killed even if there is still a pending oom victim which hasn't been fully dismantled. Is this intentional? > Signed-off-by: Zhaoyu Liu > --- > mm/oom_kill.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/oom_kill.c b/mm/oom_kill.c > index 3996301450e8..b407fba21d19 100644 > --- a/mm/oom_kill.c > +++ b/mm/oom_kill.c > @@ -308,7 +308,7 @@ static enum oom_constraint constrained_alloc(struct oom_control *oc) > static int oom_evaluate_task(struct task_struct *task, void *arg) > { > struct oom_control *oc = arg; > - long points; > + long points = 0; > > if (oom_unkillable_task(task)) > goto next; > @@ -349,7 +349,7 @@ static int oom_evaluate_task(struct task_struct *task, void *arg) > oc->chosen = task; > oc->chosen_points = points; > next: > - return 0; > + return points == LONG_MAX; > abort: > if (oc->chosen) > put_task_struct(oc->chosen); > -- > 2.17.1 -- Michal Hocko SUSE Labs