Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2145258pxb; Fri, 25 Mar 2022 11:54:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0jlL5QhoM0OwJ75ZuagGHHgzQ0VZzzc2yCTz7BECWIKJBIwVvWzNN4O2AIeIezPKb9qiS X-Received: by 2002:a17:90a:990c:b0:1bc:3c9f:2abe with SMTP id b12-20020a17090a990c00b001bc3c9f2abemr14431896pjp.220.1648234454517; Fri, 25 Mar 2022 11:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648234454; cv=none; d=google.com; s=arc-20160816; b=ObjK7WH1GsyidO+rjbn8rxW6YT+OMGu0nkgcb2RfqVlIeJggi83rCf8yjIJGD28aCq 6Axd0FpLmPBvz6FX3QCsjkExRa5nCfpjeaB26aq4M1xs/+luC1Dzmwk0dGjsaDMxHOaB jaCnu6CgKyQLrjrk1wK4O9rJiOyVlNo6kmvb8Hyu5RolWaMH5lSJRVb2phKhjm0q+08o y/diYINBk7T6JobVYPliIGVbqaT6s86Mhv1A+Ov59HfP6Bivfxt8L8s1ncYuv/533q57 joS7EyI6NJbgvgrvzBNdpSGpc7eG7FZrFg652HwZ6/a8K02cmYc9NzIFzf8YymWFnjnn kJNw== 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=ybNnrZFvehO2sUrmgdaOmgMmA2BO+ZMqy7l4uheBs3w=; b=fFKQM2dCPWW//+uSSPrc6uJDXtfWP6p7Z2+FWjOE4b9WjO3hlitWoKpCtZvHUVvi/A zbaDO9FzpbWk4h1jzGSZuVGBcOsTwnRyZWco/pbx3HTiffUy2qVx+L4JAO8CYQh74KtZ tl5MrLiguVgcTuYOlJmPfm/xOS51rvkmgfIzk+BduQXUgrNQLGwx4NQLAm3KbDOLoyW7 lYI4WgUSESmiOyerkjLIm0Xu/Hr7YdOSdd9/A5UrWqVBzxoul5hyGkAOnRLS5fFf3522 9ERN3+n2R3IL7ngYEgt63wGgArhsekQ+Vn0NfV0FFCXJx0klMHZ4TS5HRcJ5DCHFCFG4 hVFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=d+ONl8cm; 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 ct9-20020a056a000f8900b004fa3a8e007bsi3255950pfb.306.2022.03.25.11.54.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:54:14 -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=d+ONl8cm; 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 E31B81C945C; Fri, 25 Mar 2022 11:06:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356664AbiCYDKF (ORCPT + 99 others); Thu, 24 Mar 2022 23:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234794AbiCYDKD (ORCPT ); Thu, 24 Mar 2022 23:10:03 -0400 Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5151219C2E; Thu, 24 Mar 2022 20:08:29 -0700 (PDT) Received: by mail-qv1-xf2d.google.com with SMTP id r1so5255987qvr.12; Thu, 24 Mar 2022 20:08:29 -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=ybNnrZFvehO2sUrmgdaOmgMmA2BO+ZMqy7l4uheBs3w=; b=d+ONl8cm9H4sIOtGkMCPjNwc/0kPC9Xeh1De38kzAoHKpgEq0pRLnhYGQQceA5GN0I iAfkjzOWFtqcqV2eaKpyGvm0FVPlAUg4/NStnrqiE1dK3ONC3OHPOAxPajhhs4NkDjkj U2WnnZtAeHRyOsQIpWVTkKuSIqq4MUsCJDqajwAOXLT3RiEeSaZpFuYuM3XLFxJ7Nk9W fDfqe+v8mWKAw0cZvTEqtUryRbLofh/weFka/Izo3auYzot6RdOcGIqEozdp1JnWtlWK DSJbQ9l3FpEw8qbR0eWFgy3J1IC2NiMJy3kCAhNp3t94C8bowwUO9yJJq+1IKPJuB9g8 M3Vw== 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=ybNnrZFvehO2sUrmgdaOmgMmA2BO+ZMqy7l4uheBs3w=; b=oK4Yot7MghxS1SxRuWIY7+WmSOGf/P7TNtNtGLAJP3LAEecYDtDaN1lrl3DZ00yEge o064ctyjFOrRmzHD8aPYZBU0FB+jI5rAEkNugexerF7xXnzitml/lFk+XXmELLordIW7 9N7JNQOxDK3rucMIw/Kp5yxrxkIp/dZLHsiDgnrrjutDg+yOb9BFk8S8yMwFePyAv6kJ nvRxC/t0ksqYcFVQrSjP8+OdMWfSAMl+Sq6XVEb619r7gO3g55HxidYjAPkVoOHv2ljj AIfAtfa3+Lt0oURBHXFTC2QmV44P7CFm+36aZQD7bWryzK/MzQ2usKq+eqvXzM0zIh0X W4LQ== X-Gm-Message-State: AOAM532SGyd2VjSNMXPJup9x03ouk9S/mUS1l3C8XWbmOeZBDNFFtNho OO7RxeF6ys0aGUXb7haVSH+NJoi/jEFnyxW8hMc= X-Received: by 2002:a05:6214:2522:b0:441:404e:7317 with SMTP id gg2-20020a056214252200b00441404e7317mr6966072qvb.77.1648177708580; Thu, 24 Mar 2022 20:08:28 -0700 (PDT) MIME-Version: 1.0 References: <1648113743-32622-1-git-send-email-zhaoyang.huang@unisoc.com> In-Reply-To: From: Zhaoyang Huang Date: Fri, 25 Mar 2022 11:08:00 +0800 Message-ID: Subject: Re: [RFC PATCH] cgroup: introduce proportional protection on memcg To: Chris Down Cc: "zhaoyang.huang" , Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , ke wang , "open list:MEMORY MANAGEMENT" , LKML , cgroups@vger.kernel.org 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 Fri, Mar 25, 2022 at 11:02 AM Zhaoyang Huang wrote: > > On Thu, Mar 24, 2022 at 10:27 PM Chris Down wrote: > > > > I'm confused by the aims of this patch. We already have proportional reclaim > > for memory.min and memory.low, and memory.high is already "proportional" by its > > nature to drive memory back down behind the configured threshold. > > > > Could you please be more clear about what you're trying to achieve and in what > > way the existing proportional reclaim mechanisms are insufficient for you? sorry for the bad formatting of previous reply, resend it in new format What I am trying to solve is that, the memcg's protection judgment[1] is based on a set of fixed value on current design, while the real scan and reclaim number[2] is based on the proportional min/low on the real memory usage which you mentioned above. Fixed value setting has some constraints as 1. It is an experienced value based on observation, which could be inaccurate. 2. working load is various from scenarios. 3. fixed value from [1] could be against the dynamic cgroup_size in [2]. shrink_node_memcgs [1] check if the memcg is protected based on fixed min/low value mem_cgroup_calculate_protection(target_memcg, memcg); if (mem_cgroup_below_min(memcg)) ... else if (mem_cgroup_below_low(memcg)) ... [2] calculate the number of scan size proportionally shrink_lruvec get_scan_count mem_cgroup_protection scan = lruvec_size - lruvec_size * protection / (cgroup_size + 1);