Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3440003pxb; Mon, 4 Apr 2022 17:04:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4jmaRlclN+dqQYHkdm/XqMyDstXQm1BouubnhHYDtdFe4WZsVkQ5TS/X0Py+gnWfiwYHq X-Received: by 2002:a63:6e43:0:b0:386:4801:13a6 with SMTP id j64-20020a636e43000000b00386480113a6mr568164pgc.403.1649117088728; Mon, 04 Apr 2022 17:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649117088; cv=none; d=google.com; s=arc-20160816; b=YyPcLmiQ2WBzAJ8dcjlI7dGdTP+nWHZQ3FgZZUzup6nlzXQKuDLMxO9Hzw3rOumkC5 IhvM3hiOmMmEeBt4hGXyo67j65/4Xny/0gCMUnEfiHpJRvCgCk5QrwwwFB74ed9andGq SHrrsdAkgeIG+OGemkmKckdQm96LiquLYR4MRu3jGKLITsXKMJpo49B33GM8+7G54E0D egb5zk8rs2veD850L2aRLNHa6AVQbDSaDIWP0gosHRDbHsA3j+r4GXiAEUOtl62pMonJ NKKnSU0xVcU/PQ48rXFm/IHcKFOvoTVEXD2M4ShbG38spPh1SkZWbf6HNmgrIUKGOuPF LQeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/QhehSjHhOKNL81Gz/OIvOna/doU9hehd+fzE0LoRRM=; b=sF3pZLLvP932wfosEnONkfkz52YIP4+07e/Pkus1QtCfXX2BPGaK29MwBzp+zd8ZXs zAO3t2JrK0b6P7deaMPD7Wpc98qKVsJU//fiAhXZrB1njImvPp2OfkZceY4OKuUlFPwc EIaBEqVDe3KBNn21PQgsOrs+Xj8Wlbwc8uWuaPwgAFm6gwPXpLoFmgqZWp1C8t0uDYe+ dKferZLQY1FYlnCsWRpwBMWooklGSL7t0ktJtM4zwJY3Am2sLAbBoKF4My4QW3lp69bc 3GwnloIofgMbgmo+dpx2oD1wKuT+R7M+HsFjEkzJI+e4fMnuoRn0LktNUmbyhosa5npV opng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=k7X7bZkd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s13-20020a170902ea0d00b00156a03969e8si4930223plg.307.2022.04.04.17.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:04:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=k7X7bZkd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F0BF5443F2; Mon, 4 Apr 2022 16:39:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354140AbiDDJe0 (ORCPT + 99 others); Mon, 4 Apr 2022 05:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354015AbiDDJe0 (ORCPT ); Mon, 4 Apr 2022 05:34:26 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1586F22B2B; Mon, 4 Apr 2022 02:32:30 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C6639210DE; Mon, 4 Apr 2022 09:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1649064748; 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=/QhehSjHhOKNL81Gz/OIvOna/doU9hehd+fzE0LoRRM=; b=k7X7bZkdrsHkgHqwy36YGKGpfYF8iNGllvdNgCT0X1H4MVFTN6Hf/Np97vtwNdrNWixGdN Jo8z8f9KVKVHfRi1Ltdg5Av39TBpFgCoBM+w4KqvGIU904rpFl7RzMu04Q5IaQTV1g6Gfw 3iJkuTIhCsu/YgKUHy8L1oGSgcd/6HA= 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 5029DA3B82; Mon, 4 Apr 2022 09:32:28 +0000 (UTC) Date: Mon, 4 Apr 2022 11:32:25 +0200 From: Michal Hocko To: Zhaoyang Huang Cc: Suren Baghdasaryan , "zhaoyang.huang" , Andrew Morton , Johannes Weiner , Vladimir Davydov , "open list:MEMORY MANAGEMENT" , LKML , cgroups mailinglist , Ke Wang Subject: Re: [RFC PATCH] cgroup: introduce dynamic protection for memcg Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon 04-04-22 17:23:43, Zhaoyang Huang wrote: > On Mon, Apr 4, 2022 at 5:07 PM Zhaoyang Huang wrote: > > > > On Mon, Apr 4, 2022 at 4:51 PM Michal Hocko wrote: > > > > > > On Mon 04-04-22 10:33:58, Zhaoyang Huang wrote: > > > [...] > > > > > One thing that I don't understand in this approach is: why memory.low > > > > > should depend on the system's memory pressure. It seems you want to > > > > > allow a process to allocate more when memory pressure is high. That is > > > > > very counter-intuitive to me. Could you please explain the underlying > > > > > logic of why this is the right thing to do, without going into > > > > > technical details? > > > > What I want to achieve is make memory.low be positive correlation with > > > > timing and negative to memory pressure, which means the protected > > > > memcg should lower its protection(via lower memcg.low) for helping > > > > system's memory pressure when it's high. > > > > > > I have to say this is still very confusing to me. The low limit is a > > > protection against external (e.g. global) memory pressure. Decreasing > > > the protection based on the external pressure sounds like it goes right > > > against the purpose of the knob. I can see reasons to update protection > > > based on refaults or other metrics from the userspace but I still do not > > > see how this is a good auto-magic tuning done by the kernel. > > > > > > > The concept behind is memcg's > > > > fault back of dropped memory is less important than system's latency > > > > on high memory pressure. > > > > > > Can you give some specific examples? > > For both of the above two comments, please refer to the latest test > > result in Patchv2 I have sent. I prefer to name my change as focus > > transfer under pressure as protected memcg is the focus when system's > > memory pressure is low which will reclaim from root, this is not > > against current design. However, when global memory pressure is high, > > then the focus has to be changed to the whole system, because it > > doesn't make sense to let the protected memcg out of everybody, it > > can't > > do anything when the system is trapped in the kernel with reclaiming work. > Does it make more sense if I describe the change as memcg will be > protect long as system pressure is under the threshold(partially > coherent with current design) and will sacrifice the memcg if pressure > is over the threshold(added change) No, not really. For one it is still really unclear why there should be any difference in the semantic between global and external memory pressure in general. The low limit is always a protection from the external pressure. And what should be the actual threshold? Amount of the reclaim performed, effectivness of the reclaim or what? -- Michal Hocko SUSE Labs