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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9C83C433F5 for ; Mon, 4 Apr 2022 09:08:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D6956B0072; Mon, 4 Apr 2022 05:08:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 185446B0073; Mon, 4 Apr 2022 05:08:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04C986B0074; Mon, 4 Apr 2022 05:08:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0220.hostedemail.com [216.40.44.220]) by kanga.kvack.org (Postfix) with ESMTP id E5A9C6B0072 for ; Mon, 4 Apr 2022 05:08:08 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9DDF418352D33 for ; Mon, 4 Apr 2022 09:07:58 +0000 (UTC) X-FDA: 79318619436.21.AD0DA36 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by imf12.hostedemail.com (Postfix) with ESMTP id 3645840013 for ; Mon, 4 Apr 2022 09:07:58 +0000 (UTC) Received: by mail-qk1-f178.google.com with SMTP id w141so7078577qkb.6 for ; Mon, 04 Apr 2022 02:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4bEukbCR9Nhs/phBw9CHkxQ3EgSEHMJ/cxKPyV/U1Lc=; b=J5KW87ePrm1kVWM8zimS7BHw2Mzubr83uLPX1ZBEuTOjvvs+UkzK/GsTYtS+rkeeh6 Ge2jgAndu7+Zy91oVbelB/tQnEdNrikZagGfuskZmImTjrfeZFKVfsqjT4l6uBHJSGVZ VY7S7PBo+y7RdG666XUW2bx1aEo7G3ouf2K51+rUsGOhwYYyquxLNq9RdgI6zt+EI6Oq QogUEwbMxBtv/3Hc+6E7ikZQLShJTywcEZtzSZ40mqOmq5LwKkAGxigcH/x8JoioykXi D2BAEjI17KvY0X1MbUap3yVxXSGf+QKh6gAAsi1h7CMfZADAjRdbrxbuASmFKV+ZXIG/ gb5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4bEukbCR9Nhs/phBw9CHkxQ3EgSEHMJ/cxKPyV/U1Lc=; b=qEY0k6Awt6L52IS/FhTsN81FomyfksMagJuyiMzIeE/uUgBNnr+sH0hi7UgiUS6uh1 c0u+oYirgtGI7gLyl+APRLabFlb2TThj6Za9xwI+CG+QJ3tDKmgR29CxPlBPMb0hOh9q pRrJOfvF4LFPb9/VBbmA93Vk4LDSr8ZMn7W6uHc3lkH41ayWHbzjeOoAF23M1gx0DjGR k9VTUuMJxceaOxdezQyXnEVINQlNYadzgtOAvC10ApLfXe89Wk85QUjgHF8Z/Ehm2Vps F9TcS8oWTG+HT57qrKEQUnLcGdLZVi50pUZCb70nsOCqCyoJH6B7HEsojrP3SzzFTRXr ATXQ== X-Gm-Message-State: AOAM532hs1WheH4Q1OnFbj2SQovkNn+wF6S5EiDxOCJRpvFSh2HwsHCT SOuAcyDoEswx6E2oSMB2WxkgS2plOSsR+tAHx/Q= X-Google-Smtp-Source: ABdhPJzxhreJVMKs5S5FdXqt1xixG6+tcI/PtSb1hJfCARG67fDZF716ric68cm5HwCcmcK69tuvoAk4ghPFTca0/L0= X-Received: by 2002:a05:620a:108f:b0:67b:465f:56ba with SMTP id g15-20020a05620a108f00b0067b465f56bamr13401510qkk.297.1649063277536; Mon, 04 Apr 2022 02:07:57 -0700 (PDT) MIME-Version: 1.0 References: <1648713656-24254-1-git-send-email-zhaoyang.huang@unisoc.com> In-Reply-To: From: Zhaoyang Huang Date: Mon, 4 Apr 2022 17:07:30 +0800 Message-ID: Subject: Re: [RFC PATCH] cgroup: introduce dynamic protection for memcg To: Michal Hocko Cc: Suren Baghdasaryan , "zhaoyang.huang" , Andrew Morton , Johannes Weiner , Vladimir Davydov , "open list:MEMORY MANAGEMENT" , LKML , cgroups mailinglist , Ke Wang Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 3645840013 X-Stat-Signature: mif1nfhk5qkbyz5fuoo31e1mu198tqoq X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=J5KW87eP; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.222.178 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-HE-Tag: 1649063278-761399 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 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. > > > Please refer to my new version's test data > > for more detail. > > Please note that sending new RFCs will just make the discussion spread > over several email threads which will get increasingly hard to follow. > So do not post another version until it is really clear what is the > actual semantic you are proposing. ok, I will hold until all question done. > > -- > Michal Hocko > SUSE Labs