Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1143311pxb; Wed, 6 Apr 2022 09:43:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHAHHv4AUMRx20UGBgQSc8VnXDQUSKwAe7BuwOHZg0YHBQZPdEg793sPlfqb/YS0kreIZ+ X-Received: by 2002:a17:903:4115:b0:156:8951:6520 with SMTP id r21-20020a170903411500b0015689516520mr9798253pld.25.1649263397856; Wed, 06 Apr 2022 09:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649263397; cv=none; d=google.com; s=arc-20160816; b=EhtOtxm5SAXkjkDHHbUwPK1DXNQdjS2P13owp+6kc2Ir9zEyRkE1g8uKpXZMzF4nF9 mPkhzTj/HCIqk/q3NquBSd16HQ3Nr07QuzvgeZR85LSNFRTVlnW/yv0ivh6OAmzogR+8 /NPsjwvqvlOBENXdEMQKhvvWswpeKqWhe9nNOtG+8Ked/cs/4QB6HCKJvrALgyg8/eQ4 K9BeaDyi5xJRRUDWAKotMYzZBeJC1lDbaxmFuiInVTniEzxlmGBUH3/bWJZrnb1q9THM X12mOVoq/dnBo4NLkLDx5eKHdhZXb9+kg1wm7/RQvTuSpkE8BiYr/rtV5LdmZsOZPna5 XN0g== 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=wf8pQwHnRNmaHjWr1ZOvrwWsnNuIT93e+BIdPY7Vuuo=; b=sN7GJdqw3qfYH2Np5DEnNVYCD/hBW6d7J8lOtAyzn8OodHzTTSSRxKflWDgiyLaNT/ 4zDNbSeVnNPbUI4ua78lY8k14+lbdA7bTM81FIYc831Pw5o/ekHL3wESXJ+3LAcmDlDe IkHeUsMaVK7YzmHW/AXw5gKggiUCbkbOnM9gnwz0ekTA4EU/D1V89I94pftGE6UjgIk6 UUyl7v2rM0r9dcqVjM+5QDcZQY3QurYiINF1QT3YCgNupHjyv7YTCfhzJeHBcz7BBXNX ysuvq4diHfsDY9Ay2rSwLhHIEBIQi8KFTXim+icyGW1wfg97OmP+Klue5B7tCLU6Ur4B dvRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eR2P6EjB; 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 d16-20020a170902ced000b00153b2d165a0si18154904plg.424.2022.04.06.09.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 09:43:17 -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=eR2P6EjB; 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 C3948254960; Wed, 6 Apr 2022 09:26:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237375AbiDFQ1x (ORCPT + 99 others); Wed, 6 Apr 2022 12:27:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237125AbiDFQ1W (ORCPT ); Wed, 6 Apr 2022 12:27:22 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15C8624F517; Tue, 5 Apr 2022 19:11:47 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id kd21so1244338qvb.6; Tue, 05 Apr 2022 19:11:47 -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=wf8pQwHnRNmaHjWr1ZOvrwWsnNuIT93e+BIdPY7Vuuo=; b=eR2P6EjBqwGm0I3XlightluFGFW6/4Q1Fk0IBFVv0J7whG/+EutaNF17I/sCk8/LEf JkTfcbbNvUq52C1a5meMMepcUHtv/+Y3VUv4b4qaz+VXEQshKicKgiNOzSNV+CRAZotn ydZwRQKutAFaqxcZem8W/v46M/8z998iLTS2BguFC0O7aE4d7u6pC4J1nxyntWDQlgzu 9/2x6HcSRhN3lEc5TW3hexP8tzYak8NdWbYTPUUowbw2PGXJe4x0J2dfZpCsMrmmAoBc gc96Y2Eu3GR0Y3I8E8r2dfVQTP2SJct6y2F5NnnR6aMK8wq6UnA0xDVBbs9bnYbRPvP1 bsPQ== 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=wf8pQwHnRNmaHjWr1ZOvrwWsnNuIT93e+BIdPY7Vuuo=; b=1bNAyoqrpL7CUYhvFVWCTDlk1oIVwHuIOQdBBKG4rpLaLEZAwj0QmTFzA5V3vRW+5q AAB8Nn+7H0CcRg+7pr79AqevoRD6aaV6wu8Az82bzTPGn5XriEnFyIfxoW9j4ffGrgoh t2v+7dgW+dZBpIOhmaGiQfBYXGHBnIA6OfNJsV02MEBaJ88AMJcLHnEyU0sDDKMq31Iu p5UJR71som4D2l5C6Yp/YA0toVB4Zt3x52eE0Sm/sSMfOVIJZ917mENrmrX9hZOwAidY V4MVlHjByMG3DXzby+n0TR05F1AKba13dtofL38toWXnzN79d7obb+4b23ba2sKeCZf4 H28Q== X-Gm-Message-State: AOAM531p8qQ+Jr32xXDGDH91FghfsVrmFhd3mktfLs9YlEpnFwwH4UBF igsITjpQEYVAzqJ1mftOvKm76XSoFj8lLX1rYD4= X-Received: by 2002:a05:6214:238b:b0:430:842c:1863 with SMTP id fw11-20020a056214238b00b00430842c1863mr5428680qvb.105.1649211106952; Tue, 05 Apr 2022 19:11:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zhaoyang Huang Date: Wed, 6 Apr 2022 10:11:19 +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 Tue, Apr 5, 2022 at 8:08 PM Michal Hocko wrote: > > On Mon 04-04-22 21:14:40, Zhaoyang Huang wrote: > [...] > > Please be noticed that this patch DOES protect the memcg when external > > pressure is 1GB as fixed low does. > > This is getting more and more confusing (at least to me). Could you > describe the behavior of the reclaim for the following setups/situations? > > a) mostly reclaiming a clean page cache - via kswapd > b) same as above but the direct reclaim is necessary but very > lightweight > c) direct reclaim makes fwd progress but not enough to satisfy the > allocation request (so the reclaim has to be retried) > d) direct reclaim not making progress and low limit protection is > ignored. > > Say we have several memcgs and only some have low memory protection > configured. What is the user observable state of the protected group and > when and how much the protection can be updated? I am not sure if I understand you right. Do you have suspicions on the test result as you think protected memcg has no chance to update the protection or the global reclaim should have been satisfied with the reclaiming(step d is hard to reach?). Let me try to answer it under my understanding, please give me feedback if you need more info. The protection is updated while mem_cgroup_calculate_protection is called during either kswapd or direct reclaim for each round of the priority reclaiming and then the memcg's lruvec will be reached in step d. > > I think it would be also helpful to describe the high level semantic of > this feature. > > > Besides, how does the admin decide > > the exact number of low/min if it expand from small to even xGB in a > > quick changing scenario? > > This is not really related, is it? There are different ways to tune for > the protection. I don't think so. IMO, it is hard to protect when memcg has a wide and random range of its usage especially when depending on scenarios. Does the example of EAS on scheduler make more sense? When comparing with the legacy CFS, EAS does be against to some original design as load balance etc, while it will keep some small tasks into one CORE. > > [...] > -- > Michal Hocko > SUSE Labs