Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3460236pxb; Mon, 4 Apr 2022 17:41:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx/aOMuMy8L8Zzw3yx+JmwCd0hZysUTrzALHO7WfaRM+nDAXmvBQVxqRna1Ralyu0ANTzG X-Received: by 2002:a17:902:7c01:b0:156:17a5:a68 with SMTP id x1-20020a1709027c0100b0015617a50a68mr750951pll.166.1649119290533; Mon, 04 Apr 2022 17:41:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649119290; cv=none; d=google.com; s=arc-20160816; b=iIekdStFIHfT39Qke51WqMVb+TMOsRTToX8Aj7Yo09RwRhwesj/i6LkVF5Y6Fb6UlT yBz/Nmcrd+L/MXMQI1qq989bkMnlquI15ldJJhpktINgAmyt7lCY5rBdYPUk76Iul1vk UxjlFQ0pAx/1uz4XKCpxtKnHwFqMT69a5IlW2IUL9CW8ouH7oEQbCdoX7ssPvdc1w/0d 7o7NxcuRPpBAfEEEkBqau3OvbgjyyPwRKxXoF7TDxMzIvALvmrQ0WvdQsbhg16oRUmgL A2fL2P1AS2tijD8eCK03f3wLepF4opneJAVUMJSPu42G+OOqy+/hLDUeW2KJ3ZwXuv/U 30FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oXmJJ5+eLXFpFacDKNV9S+2RH6HTol71eIq9kzYo+Zo=; b=Ox9TIN0ZgGJOGnAk5SLi0J7tcDdAdga0+hgCp6DgIV2Q7oJNwwaLexeasFbTUi5LFl dg6CitwR6TWFPAlEaaERzrAvmUJjGbDCEGhwh/Mf84CWOAFGWjvF3Y631zHuwaJ2fLdm bhhBVlE+kQgd/FBpt10Lj2ooHsSJ51JuzRFHH8emkN8PYQC/Y/dN1/A6segFa5gJcsVa DRCvSHeAXzn3W31nUrFwyWJlnAS4QEJW8JH4GJl1tBZZ5OHMPX/H6oTMGxjhQfMSdAjx dsWyF6/4t6IWS9NGAUYz/UuD8f4RUucxWITpK6ZXtBxdyZ0nCav1emjhKMNTxJ05PKFk 0Ogw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eflAGqZ3; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u1-20020a17090341c100b00153b2d165b0si12331889ple.440.2022.04.04.17.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:41:30 -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=@gmail.com header.s=20210112 header.b=eflAGqZ3; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D9D4293997; Mon, 4 Apr 2022 16:55:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349496AbiDDJ0I (ORCPT + 99 others); Mon, 4 Apr 2022 05:26:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236317AbiDDJ0H (ORCPT ); Mon, 4 Apr 2022 05:26:07 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0902424589; Mon, 4 Apr 2022 02:24:12 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id c4so7193861qtx.1; Mon, 04 Apr 2022 02:24:11 -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=oXmJJ5+eLXFpFacDKNV9S+2RH6HTol71eIq9kzYo+Zo=; b=eflAGqZ3vQTJxGYGbegq1IkJ1Jj7j6sR79EJcRJ6tIr2aMi/46tQdVwR8fYN2kOQ6J nfQxDRXc/vXsD9gMO2zhmgXzpaKvpmvzWAAfTcrbg4tvTH7tlhyQWYf79I58B/XnndMj dqSrGuAjJ5M78Z9iFuUgLFORB8JJgOBV3fBG9y4Cn14m6plu7SILNcI8fjKS+q2PqjVY rRjvDhiqoZGTDrU9QfgdRJYjejVuxOIrZpoQjwNiMHk1nt2vCrHa/tHYVOdynIYpS50B KkQl3sZ+bobm6bOMiqJlOeZibzkmAseeD4kLYm+6giD17MjEbmDDIZjtI6s7BuhgfCNu xVIQ== 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=oXmJJ5+eLXFpFacDKNV9S+2RH6HTol71eIq9kzYo+Zo=; b=ZezDjUz+ZspV6Wy/wkToc5RtPfB6HcUUwqO8hLvFu69sK2svQ2o3VNR6pI3YfhHRTe jSyi0pu8UMOEOmswPmgSP4aBIy4jIsaxnX+xPOZOxYmcftPG1QTt1ou8S1JmCNycbrUe njwiHCR6kzmXOXIsUvjBWYnW/Ye8vi8X1Z5KLRJEC0KtZbwZ/QbDBhXvcc94mh22lQMo C0XLtYotzgf+MzssGq8GHl77I1Cpxyc/sh7vg8a3r/Mdjza9CJtO3A+WWxbnYLONPHvs pfWXSHFVH/Sk0gZihu2MPhHPYul6T6II8e364r5mKe124/zOhXEvXOFqObWsAxPQS23N Cz/w== X-Gm-Message-State: AOAM531MjL1FHK/DeOHqKsRKZuUjnivEywVoU8iz6eEnng6DMqQZ7zde HwU7F2+DrigAWLG1KcgKk05Sir+CXbUGDciwAxXanFMcEwo= X-Received: by 2002:ac8:4e50:0:b0:2e2:17a8:2ab0 with SMTP id e16-20020ac84e50000000b002e217a82ab0mr16600488qtw.68.1649064251177; Mon, 04 Apr 2022 02:24:11 -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:23:43 +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-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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, 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) > > > > > 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