Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1720995ybk; Mon, 11 May 2020 02:38:23 -0700 (PDT) X-Google-Smtp-Source: APiQypI8eKes3U0t5Hlsx+FtB2ol1uQbEocMguyULyW4w/V+oErB/8hCWzB+zGUnA908CoEXo3KO X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr12975333ejb.124.1589189903177; Mon, 11 May 2020 02:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589189903; cv=none; d=google.com; s=arc-20160816; b=rlIgSDnl4HJgvHnwkzQqaPML5vhIuJU0cdspOZW4aIF8bu4EzqvyJ/DblGXFGt0wy8 Agvz0dcKABrdDcLZGKcTLYYAPZlvNeiLSiVwvXEvBMsYkMlXabUQyonU9M1b7kGTMiKv 6+K6Y7PipcXMBd1/a6x0OKi5KKvBSZRjWdDOEnLq2Jnoj9XYf6Bpie9R7Sjnx8sWJgFD EhqXS2lnfaCruB7tsJwxUPqTXdGNJ6EPOvI0R3YpCwW2xbZ2dca6UTZtzW9CqJCDdEHl uv5jlB1iXV/jGyB0CIG7ZgM88gP8n6soFHOicSXwPuoNgZlZuytcfs+mWsnPybJwSfHp MsSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=MGEF9xP5Qv6FPGCxjbJhWxmWFx6dPI6oeezhHBsf+rc=; b=0PU6/2QYQbEutDrKxQ28Yjl3Hv52RM67Bw44OvJ7+G7geGfoz9HUKDUu/NTRgZH7Ys i3mOOdP8eZ9MKTGJsNgfIPkhy6DbnZuwc8LtVmSa7Sv4ZHYrdMomKHstL8az0yF+rDIP 00S2O+FGCHId3KGoko29BMGigYrLKGGVBm6f9eaNMLtN7w7u7TyubQR7TRMCjR0owl1B 71tgmv7oiMax6zeyNoBmJg9bCJXaw1LohjtUN8Cwmn+G0Bi0kTt+eIzJHqjKk1+ZTmun 54THggtVGQHQpUPFd3T/cGlVEs+n46k9cBgHC94awU+kJ0h/rj5ynX06+n5oL8KsxpUe 7EDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=mwS7DMSv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si5428905ejw.468.2020.05.11.02.38.00; Mon, 11 May 2020 02:38:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=mwS7DMSv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729572AbgEKJeH (ORCPT + 99 others); Mon, 11 May 2020 05:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725790AbgEKJeH (ORCPT ); Mon, 11 May 2020 05:34:07 -0400 Received: from forwardcorp1o.mail.yandex.net (forwardcorp1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FED6C061A0C for ; Mon, 11 May 2020 02:34:06 -0700 (PDT) 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >