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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71E47C47255 for ; Mon, 11 May 2020 09:34:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3112B2075E for ; Mon, 11 May 2020 09:34:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yandex-team.ru header.i=@yandex-team.ru header.b="mwS7DMSv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3112B2075E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=yandex-team.ru Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C1A9590001A; Mon, 11 May 2020 05:34:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BA478900006; Mon, 11 May 2020 05:34:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6C0990001A; Mon, 11 May 2020 05:34:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id 8CD41900006 for ; Mon, 11 May 2020 05:34:06 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 48E81180AD80F for ; Mon, 11 May 2020 09:34:06 +0000 (UTC) X-FDA: 76803926892.22.hair40_5de4d2f882706 X-HE-Tag: hair40_5de4d2f882706 X-Filterd-Recvd-Size: 5151 Received: from forwardcorp1o.mail.yandex.net (forwardcorp1o.mail.yandex.net [95.108.205.193]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 May 2020 09:34:05 +0000 (UTC) Received: from mxbackcorp2j.mail.yandex.net (mxbackcorp2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::119]) by forwardcorp1o.mail.yandex.net (Yandex) with ESMTP id 9278C2E0B11; Mon, 11 May 2020 12:34:02 +0300 (MSK) Received: from myt4-18a966dbd9be.qloud-c.yandex.net (myt4-18a966dbd9be.qloud-c.yandex.net [2a02:6b8:c00:12ad:0:640:18a9:66db]) by mxbackcorp2j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id reGjoSLEJq-Y0XqJVmE; Mon, 11 May 2020 12:34:02 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1589189642; bh=MGEF9xP5Qv6FPGCxjbJhWxmWFx6dPI6oeezhHBsf+rc=; h=In-Reply-To:Message-ID:From:Date:References:To:Subject:Cc; b=mwS7DMSvBj3jlt9a2sJJCwLOkbkP58CsD+3SORjXLPm3zW7gkn/BKPM+pVY/cY8Kd KtQfD44pPGcoG4Unlp3e9zHUPnnQ/juS1UrcPZfdE1r+UuTCYen3qntrUl4pCIQLdR ftmD1pKYDy0WojoV1lcmwF07jbHqD+hRwG1y/XHw= Authentication-Results: mxbackcorp2j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:423::1:1]) by myt4-18a966dbd9be.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id YWKiKxEGPb-Y0WG1DhL; Mon, 11 May 2020 12:34:00 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Subject: Re: [PATCH] doc: cgroup: update note about conditions when oom killer is invoked To: Michal Hocko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , cgroups@vger.kernel.org, Roman Gushchin References: <158894738928.208854.5244393925922074518.stgit@buzz> <20200511083904.GB29153@dhcp22.suse.cz> From: Konstantin Khlebnikov Message-ID: <0ddb8e58-5bfd-7754-6979-4276acf5b4c8@yandex-team.ru> Date: Mon, 11 May 2020 12:34:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200511083904.GB29153@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit 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 11/05/2020 11.39, Michal Hocko wrote: > On Fri 08-05-20 17:16:29, Konstantin Khlebnikov wrote: >> Starting from v4.19 commit 29ef680ae7c2 ("memcg, oom: move out_of_memory >> back to the charge path") cgroup oom killer is no longer invoked only from >> page faults. Now it implements the same semantics as global OOM killer: >> allocation context invokes OOM killer and keeps retrying until success. >> >> Signed-off-by: Konstantin Khlebnikov > > Acked-by: Michal Hocko > >> --- >> Documentation/admin-guide/cgroup-v2.rst | 17 ++++++++--------- >> 1 file changed, 8 insertions(+), 9 deletions(-) >> >> diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst >> index bcc80269bb6a..1bb9a8f6ebe1 100644 >> --- a/Documentation/admin-guide/cgroup-v2.rst >> +++ b/Documentation/admin-guide/cgroup-v2.rst >> @@ -1172,6 +1172,13 @@ PAGE_SIZE multiple when read back. >> Under certain circumstances, the usage may go over the limit >> temporarily. >> >> + In default configuration regular 0-order allocation always >> + succeed unless OOM killer choose current task as a victim. >> + >> + Some kinds of allocations don't invoke the OOM killer. >> + Caller could retry them differently, return into userspace >> + as -ENOMEM or silently ignore in cases like disk readahead. > > I would probably add -EFAULT but the less error codes we document the > better. Yeah, EFAULT was a most obscure result of memory shortage. Fortunately with new behaviour this shouldn't happens a lot. Actually where it is still possible? THP always fallback to 0-order. I mean EFAULT could appear inside kernel only if task is killed so nobody would see it. > >> + >> This is the ultimate protection mechanism. As long as the >> high limit is used and monitored properly, this limit's >> utility is limited to providing the final safety net. >> @@ -1228,17 +1235,9 @@ PAGE_SIZE multiple when read back. >> The number of time the cgroup's memory usage was >> reached the limit and allocation was about to fail. >> >> - Depending on context result could be invocation of OOM >> - killer and retrying allocation or failing allocation. >> - >> - Failed allocation in its turn could be returned into >> - userspace as -ENOMEM or silently ignored in cases like >> - disk readahead. For now OOM in memory cgroup kills >> - tasks iff shortage has happened inside page fault. >> - >> This event is not raised if the OOM killer is not >> considered as an option, e.g. for failed high-order >> - allocations. >> + allocations or if caller asked to not retry attempts. >> >> oom_kill >> The number of processes belonging to this cgroup >