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 EC285C43334 for ; Tue, 14 Jun 2022 07:50:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 345DE8D0227; Tue, 14 Jun 2022 03:50:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F61B8D0226; Tue, 14 Jun 2022 03:50:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BD9C8D0227; Tue, 14 Jun 2022 03:50:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 095F58D0226 for ; Tue, 14 Jun 2022 03:50:41 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B7181214CD for ; Tue, 14 Jun 2022 07:50:39 +0000 (UTC) X-FDA: 79576069398.10.5612134 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf14.hostedemail.com (Postfix) with ESMTP id B5AB8100082 for ; Tue, 14 Jun 2022 07:48:22 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 7FE4D1F90C; Tue, 14 Jun 2022 07:48:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1655192901; 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=vmDK7ZYK4AL37+SEeqVJBV/ltfSvnAp1okhtoRMfG/M=; b=KbJ0eW5Hdov+/dcJi0R+DP7RhTeXmL8Q7iSh4uJhvJL2OCSX6cymIh9SqlBSrrwr7STzpD EIXFK/gHr15xzlZEYqCruRh+vuF85w04e//pLP1U4zX4bJpd9oSKMDZRJ1GWgKU1a5oDZh N73wt4ADuGFJlf1K+00uSzBSIXf8sAA= 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 662472C141; Tue, 14 Jun 2022 07:48:21 +0000 (UTC) Date: Tue, 14 Jun 2022 09:48:20 +0200 From: Michal Hocko To: "akpm@linux-foundation.org" , Zackary Liu Cc: "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: <6BC32F66-2AC4-450D-90D5-B7A09455B617@getmailspring.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655192913; a=rsa-sha256; cv=none; b=2coVj+jxl4Zy4OOpshdbNW5cWRpTycDFlSloq9Jz3hNjdIFu98lVAc7sCAy75yqCoI/dYy /Q+wlgNJY5VqBkB4YeIO3VLFapFDaonAdikypv36t8VudT5BSg+txvE4jL2lDJvdDCgAsp 6I5JHRfUoBIBHmvQgrYMxLJJIa5LObc= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=KbJ0eW5H; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf14.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655192913; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vmDK7ZYK4AL37+SEeqVJBV/ltfSvnAp1okhtoRMfG/M=; b=FyHs6lS6GsC6EoLCahdDdtV4bFVHIXMW3d8ECMM6MnPgLOLCKCNgBTDcUtghlCDZfcuj/7 Me5j/ppxZhbcryx5/d1ECRhLlQ8yr86VuyaqsvmCh/PMId7mcCZNOkk4Ap5fkfiPwAd5mo 9zlPvuDM3DoeKx5eBGR+cDeEbSPOvzw= X-Rspamd-Queue-Id: B5AB8100082 X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=KbJ0eW5H; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf14.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Rspamd-Server: rspam06 X-Stat-Signature: 6at3j8ixs1e7nmoe1srbqostaqhghih1 X-HE-Tag: 1655192902-79566 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 Mon 06-06-22 10:33:30, Michal Hocko wrote: > On Sat 04-06-22 18:35:19, Zackary Liu wrote: > > > > On Jun 1 2022, at 3:45 pm, Michal Hocko wrote: > > > > > 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? > > > > Thank you very much for reminding. > > > > From my point of view, the victim was marked in the last oom, and now it > > has entered the oom again, which means that the system still has no > > deprecated memory available. > > This is not an unusual situation. OOM victims can take some time to die > and release their memory. The oom_reaper is there to fast forward that > process and guarantee a forward progress. But this can still take some > time. Our general policy is to back off when there is an alive oom > victim encountered. Have a look at the tsk_is_oom_victim test in > oom_evaluate_task. For that heuristic to be effective the whole task > list (wether the global one or memcg) has to be evaluated. > > > In order to ensure that the system can > > return to normal as soon as possible, killing the origin task > > immediately should be A good choice, and the role of this patch is to > > end oom_evaluate_task and return true as soon as the origin task is found. > > Could you be more specific how does this patch guarantees a forward > progress? What is the actual usecase that benefits from this change? > > These are all important information for future reference. Please note I > am not saying the patch is wrong. I just still do not see why it is > useful. > > > Maybe this patch is not the optimal solution, it has a trade-off. > > If there are trade-offs, please document them in the changelog. > > The way I see it is that oom_task_origin heuristic has been introduced > to help killing swapoff operation because the swapped out memory doesn't > fit into memory. This is a very reasonable thing to do in general but it > also represents an early failure visible to the userspace. If there is a > pre-existing oom victim then I would argue that we should try to avoid > the failure. Andrew, please drop this patch from your tree. I do not see any real justification here. Thanks! -- Michal Hocko SUSE Labs