Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1515362rwd; Thu, 1 Jun 2023 17:27:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6EOB4KU9hZTsQZQa433HNG78YfgbNu9X6Gjp4H7sjIIpclVkvRoasm6mo44Zx+/3Uev3Au X-Received: by 2002:a05:6358:9896:b0:123:5c29:c39a with SMTP id q22-20020a056358989600b001235c29c39amr7211294rwa.31.1685665649510; Thu, 01 Jun 2023 17:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685665649; cv=none; d=google.com; s=arc-20160816; b=quN33xt0LsmqGrb/uuRUqBYAfPMS6AfUj4wkHwAs5MeTkSriiPkY4920aFSTT8b0Vb RdKhseIN97MeYZKS5Ge8ZizEpAAbiVIn0OdyvAvwOMbdO+K3rIfNYBn9o6M/YodAtCb4 LFBnyERjEvPBmtq53q2q0+UAEFEINRtPXPiqbiM4jTMwBZQQReqEryO6vaSQLLG3zECf wQxJXbuSyBISWaclyUB8XRXwNAEM5AXD3Orb7mZNAiA9SCBAs51EdII40dle6bpPXVqc 3R/ta3ojLHp8BRGJZBBxpQ7RjG4EaLPlHTnbtO67cH2TlBBsN/SEiJwrDaHeeA/DFPuP 2/NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=IQBTL4KWFtPVFbs25Ot9x0LJbTVOUU336wX1+2B8Rjk=; b=pfuSje0SJNLVGSAm4i8D9eHZDEuQfOS6BX5lT1ADnOQBSUzLcfwGg44+iFcjWF3WqT KUCUxAxdqmFpwzTVPV80HV9O/tZs19A2OZ21USW46v3+nF4QZeDFmUgC425g/32ZTA6c c/iKdB+FgWgR9mAafO22iCZHUN7pq0U3n53XMEpGVzK67dqiLNjoMu6u2NpZmIbzIEyJ 7sOOc9LIhs0mQ+10D4e1tv3wF0QokovggSvmq8cfdCQHFn61Er5hPPgLtGZcsAUhUiVH DPcVJWUrHigDdTi5DT2DifcDvTKa05opUZ3BLODIbTAY1piZRhkQNLqSva+TiLSAS2OK m6FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KRpQ4p0l; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k62-20020a636f41000000b005211941267asi70520pgc.153.2023.06.01.17.27.15; Thu, 01 Jun 2023 17:27:29 -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=@redhat.com header.s=mimecast20190719 header.b=KRpQ4p0l; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229454AbjFBAKg (ORCPT + 99 others); Thu, 1 Jun 2023 20:10:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232056AbjFBAKe (ORCPT ); Thu, 1 Jun 2023 20:10:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1AD5192 for ; Thu, 1 Jun 2023 17:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685664589; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IQBTL4KWFtPVFbs25Ot9x0LJbTVOUU336wX1+2B8Rjk=; b=KRpQ4p0lsShjgPrAistGE/q1NYddVokZjzPFvH4uYqcHDmRVzEnRJo780JG87vyGphuLt7 i258NdJqtQKHW3iIoWOt6OJj53De3Y/lciw+ZK4Yr2tXHpj7gvN18a4LKkupNqo7vBa7Em Od1Zak1Irl8wtzAl6tsLUdpGWoO8u70= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-569-bkhrC-83MXW-CYPiVx5WNw-1; Thu, 01 Jun 2023 20:09:43 -0400 X-MC-Unique: bkhrC-83MXW-CYPiVx5WNw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 59A152932493; Fri, 2 Jun 2023 00:09:43 +0000 (UTC) Received: from [10.22.8.52] (unknown [10.22.8.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id A1B0A40C6EC4; Fri, 2 Jun 2023 00:09:42 +0000 (UTC) Message-ID: Date: Thu, 1 Jun 2023 20:09:42 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH] Documentation: Clarify usage of memory limits Content-Language: en-US To: Johannes Weiner Cc: Dan Schatzberg , Tejun Heo , Chris Down , Zefan Li , Jonathan Corbet , "open list:CONTROL GROUP (CGROUP)" , "open list:DOCUMENTATION" , open list References: <20230601183820.3839891-1-schatzberg.dan@gmail.com> <20230601195345.GB157732@cmpxchg.org> From: Waiman Long In-Reply-To: <20230601195345.GB157732@cmpxchg.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 6/1/23 15:53, Johannes Weiner wrote: > On Thu, Jun 01, 2023 at 03:15:28PM -0400, Waiman Long wrote: >> On 6/1/23 14:38, Dan Schatzberg wrote: >>> 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. >> That is not how my understanding of memory.high works. When memory usage >> goes past memory.high, memory reclaim will be initiated to reclaim the >> memory back. Stall happens when memory.usage keep increasing like by >> consuming memory faster than what memory reclaim can recover. When >> memory.max is reached, OOM killer will then kill off the tasks. > This was the initial plan indeed: Slow down the workload and thus slow > the growth; hope that the workload recovers with voluntary frees; set > memory.max as a safety if it keeps going beyond. > > This never panned out. Once workloads are stuck, they might not back > down on their own. By increasingly slowing growth, it becomes harder > and harder for them to reach the memory.max intervention point. > > It's a very brittle configuration strategy. Unless you very carefully > calibrate memory.high and memory.max together with awareness of the > throttling algorithm, workloads that hit memory.high will just go to > sleep indefinitely. They require outside intervention that either > adjusts limits or implements kill policies based on observed sleeps > (they're reported as pressure via psi). > > So the common usecases today end up being that memory.max is for > enforcing kernel OOM kills, and memory.high is a tool to implement > userspace OOM killing policies. > > Dan is right to point out the additional expectations for userspace > management when memory.high is in used. And memory.max is still the > primary, works-out-of-the-box method of memory containment. Thanks for clarification. I have to reset my false assumption. Cheers, Longman