Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3904809rwd; Sat, 3 Jun 2023 14:51:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vu2ZhgDZhs3WwK8GPwboG7MAo+hAOc0Nqu1jqLCyieCzJ4co1SciyZe7FcfY9e1cJsPat X-Received: by 2002:a05:6a20:9185:b0:10c:49e:6c67 with SMTP id v5-20020a056a20918500b0010c049e6c67mr805209pzd.33.1685829090324; Sat, 03 Jun 2023 14:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685829090; cv=none; d=google.com; s=arc-20160816; b=Qk4BxUZZz7QoL5YM6Ra1rd+GZgnHjSP2n7107r88iUUjuLfer///PKcUdO6/HHwlN9 wctokqBijpzCKRO8ZnrUEB0X/WGAn+DG3N6xEqUGXAIbbVPRYVGW1CKluGQltUFfzkVb 7F1xNP9FKFMVVXrF7sHfHfoiXW+Rn3o2sSInvhu1b3JnZ418RvgNqLplroZ5i+8CIk8W s/iS15IJKFaqIEkuTpLMe4WJChA1224ea/t5uMa3XKzq4gSvupebk19JtUyP2POtqrgs tz1rkH32A3UEWqtbf/aanHeU8mHBTtIZJ0YPx0CYVbooYLZGwWkyBP1uuYjS9KI2ysJf GgHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=VPgdBuOb3Mk3v1wiPzP0vcApMpycUA28Au999GkAKxA=; b=yN21ikBxCdvVZnux8VB3WjoephQqucZERk2FK4jBq44TXQm+IbWSvy9UpPrw9ejgoV dr4us6A8PAY04jwf2I+nDxSr8rdQS8n4cK5zkDbV4gLrOkp6tOVesl7kwcFb03A1btfS GrS+aDUNHKxgcgNNWi2+/8J/Vzo+uBBJpPoQTkmKklu+8ijpt6q6uGnmgIPgKtSeCxDY rdeXd48zZ5iEqKozttw++kSX2BkP8T7YYb4t6RcO1gZzS1rtBJQSvpwkfAXPJPFTYK0x Yp9ppLUgKGGK29qUjljYZjXXgB9Hpphm4Ow4zks2zgDlIG+ursRQYPyOVRsA6UmqGAA3 KmJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=D3Y8+UlB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170902bd8d00b001aaef930752si2898369pls.647.2023.06.03.14.51.18; Sat, 03 Jun 2023 14:51:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=D3Y8+UlB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229452AbjFCVdz (ORCPT + 99 others); Sat, 3 Jun 2023 17:33:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjFCVdy (ORCPT ); Sat, 3 Jun 2023 17:33:54 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BFF7AF for ; Sat, 3 Jun 2023 14:33:53 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-514924b4f8cso5055787a12.3 for ; Sat, 03 Jun 2023 14:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; t=1685828031; x=1688420031; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=VPgdBuOb3Mk3v1wiPzP0vcApMpycUA28Au999GkAKxA=; b=D3Y8+UlBvD28MImoMBw8EQN27ymlp+CpIHs8DUTXSuWC/2z4HjNVGgQw6xlaEWYl7y tBzUH8yq2WdHoBJBJCMkaXOabLKHqgpvAvXB+x2Lq/oldMQ6qb87FFv3ro42Gx3wP4+p Sf398UgV54hGA+VSakDaldq+PoP4qE3KtkEIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685828031; x=1688420031; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VPgdBuOb3Mk3v1wiPzP0vcApMpycUA28Au999GkAKxA=; b=ViSyub2WjJaPVMiXESK5XHTtHWo441usMG8ebZBE29VbYX6raDt53CkSMvXgpebuMC KMPQgTd2jR8gm8fuMmsbKZoAR1GddCJireKo9CY9OP8sK6zDjkAofREkmYL1CWmIu1+n D1TSSc6bKsnKf4JWNIG0Zc/OZMJAU2CI/QludhT6zakt7ROlNp2/MT14YWtJvvqFxrMF KmfCMrzksl3dxaf68D5djxDCEguLIsgdKRhswwdB9DfL5+lTpy/MDUzbNJVMvhWO+iWX QKimYX3xSOs9A0dpVmBeb97C3d9N0+EjLrjOLutw/2hXJrcjaLweo5KJL7I6RRzGmuLT QPrg== X-Gm-Message-State: AC+VfDw/SS9sCUIbei072CgpVn6MYlsvuhw2jy8uaESkk76Y5UIaAY4X vlKoKq0XB8FsOiD8HURDnjVQWw== X-Received: by 2002:aa7:d6d1:0:b0:514:9c7c:8a30 with SMTP id x17-20020aa7d6d1000000b005149c7c8a30mr4587074edr.30.1685828031461; Sat, 03 Jun 2023 14:33:51 -0700 (PDT) Received: from localhost ([2620:10d:c092:400::5:1bec]) by smtp.gmail.com with ESMTPSA id n8-20020a05640204c800b005106975c7a1sm2170030edw.23.2023.06.03.14.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Jun 2023 14:33:51 -0700 (PDT) Date: Sat, 3 Jun 2023 22:33:50 +0100 From: Chris Down To: Dan Schatzberg Cc: Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , "open list:CONTROL GROUP (CGROUP)" , "open list:DOCUMENTATION" , open list Subject: Re: [PATCH] Documentation: Clarify usage of memory limits Message-ID: References: <20230601183820.3839891-1-schatzberg.dan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20230601183820.3839891-1-schatzberg.dan@gmail.com> User-Agent: Mutt/2.2.10 (2023-03-25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dan Schatzberg writes: >The existing documentation refers to memory.high as the "main mechanism >to control memory usage." This seems incorrect to me - memory.high can >result in reclaim pressure which simply leads to stalls unless some >external component observes and actions on it (e.g. systemd-oomd can be >used for this purpose). While this is feasible, users are unaware of >this interaction and are led to believe that memory.high alone is an >effective mechanism for limiting memory. > >The documentation should recommend the use of memory.max as the >effective way to enforce memory limits - it triggers reclaim and results >in OOM kills by itself. > >Signed-off-by: Dan Schatzberg Oof, the documentation is very out of date indeed -- no wonder people were confused by other advice to only use memory.high with something external monitoring the cgroup. Thanks! Acked-by: Chris Down >--- > Documentation/admin-guide/cgroup-v2.rst | 22 ++++++++++------------ > 1 file changed, 10 insertions(+), 12 deletions(-) > >diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst >index f67c0829350b..e592a9364473 100644 >--- a/Documentation/admin-guide/cgroup-v2.rst >+++ b/Documentation/admin-guide/cgroup-v2.rst >@@ -1213,23 +1213,25 @@ PAGE_SIZE multiple when read back. > A read-write single value file which exists on non-root > cgroups. The default is "max". > >- Memory usage throttle limit. This is the main mechanism to >- control memory usage of a cgroup. If a cgroup's usage goes >+ Memory usage throttle limit. If a cgroup's usage goes > over the high boundary, the processes of the cgroup are > throttled and put under heavy reclaim pressure. > > Going over the high limit never invokes the OOM killer and >- under extreme conditions the limit may be breached. >+ under extreme conditions the limit may be breached. The high >+ limit should be used in scenarios where an external process >+ monitors the limited cgroup to alleviate heavy reclaim >+ pressure. > > memory.max > A read-write single value file which exists on non-root > cgroups. The default is "max". > >- Memory usage hard limit. This is the final protection >- mechanism. If a cgroup's memory usage reaches this limit and >- can't be reduced, the OOM killer is invoked in the cgroup. >- Under certain circumstances, the usage may go over the limit >- temporarily. >+ Memory usage hard limit. This is the main mechanism to limit >+ memory usage of a cgroup. If a cgroup's memory usage reaches >+ this limit and can't be reduced, the OOM killer is invoked in >+ the cgroup. Under certain circumstances, the usage may go >+ over the limit temporarily. > > In default configuration regular 0-order allocations always > succeed unless OOM killer chooses current task as a victim. >@@ -1238,10 +1240,6 @@ PAGE_SIZE multiple when read back. > Caller could retry them differently, return into userspace > as -ENOMEM or silently ignore in cases like disk readahead. > >- 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. >- > memory.reclaim > A write-only nested-keyed file which exists for all cgroups. > >-- >2.34.1 >