Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp51035pxh; Thu, 7 Apr 2022 13:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy52U6+9+pqNqvB3q0hHr7vblfQ8swK69lR0UeWpuZABlcPCYPAtvRerxMy1DyRo4QZCQOt X-Received: by 2002:a17:902:7e0d:b0:156:47a4:a7c4 with SMTP id b13-20020a1709027e0d00b0015647a4a7c4mr16134522plm.141.1649364040631; Thu, 07 Apr 2022 13:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649364040; cv=none; d=google.com; s=arc-20160816; b=AD0xJfasmWwRgL8GeLw3uUYyNcxIwRakLNa5R7mLxpjvQ9y1Lycev326gV7SB55r8G VU/HJwE9hjz/ylTmt4GzaJhDVbdXWmNyT2PAwJfVENbpbaYt8jwF22F10r8woJ84gD61 afZId6vkNfA1v9Y9S9lohJc9R2CG+/Zb70Ou4L4ZkwsUHjOv4fa7XdWGoDgxGm7ITZdY fKpWoSYyKvjJ3B91Te0CZCDnpqOE/YgMfnuQbuOEjnKoSs4P+0zGwrmJG1a+bfgvBJig IuN0Qx04HQRI+QGoNFhpxLvt1albWjMSJG1xCQG9O6vDgz8Iy85B8pzJj9/voL/24EEb e3VQ== 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=OH445ysdzmR/6X4//W4FphZ3nFgmJO7HaScUHltGfzw=; b=V1sBXHHiY4n+iCNpPxJxTRuIPwnI9mSFSlOnQTpK97RicA/LUAtLLncWqn+q2ldUoi shn/Tgp7Glg+2l/MHPK/d6t2H2CpQQNdpU7Ju50SOu2eLlqkSdXjfw4wraFPg2ZRhvmw A4todfkiHagzfLB2TYDmc6vJcu0vF/GeVRmmbySvHFG3pK290qymz/bQ2P/x2h60Srdp 29s/4KqvRAIkA4AWNSfRkHY35aJUwOnbtCh96t7dt284XqCCizrXd2MWDw7+EyDRAUj2 OcAaXNlIk0f0nJQOxkvvUOSKRv0KB+kESpYKJzdEGnZc2Y8hLjT5WRBsW/7extPh8+DB AveA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A2BZMU75; 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 p8-20020a056a000b4800b004fa3a8e009bsi21467774pfo.338.2022.04.07.13.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:40:40 -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=A2BZMU75; 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 ED9613BD24A; Thu, 7 Apr 2022 12:51:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243572AbiDGJCd (ORCPT + 99 others); Thu, 7 Apr 2022 05:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243533AbiDGJCS (ORCPT ); Thu, 7 Apr 2022 05:02:18 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B70A11F519B; Thu, 7 Apr 2022 02:00:18 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id s11so7597589qtc.3; Thu, 07 Apr 2022 02:00:18 -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=OH445ysdzmR/6X4//W4FphZ3nFgmJO7HaScUHltGfzw=; b=A2BZMU75Gg9tMr3xOhA9ZXdTsJVp+kREzAIB13tKhOdgL+04uX1xdkg9fVTnFs674p /fHfbxKgZ61ztlad8Ira/55MLMfPEcdrjUEE5foKxKd8fmuMGv8bdE3QVx7o8ia3fDlR s8/yOt1GIWAXGX2d3zLoV2l1EuKXIJXClGdFtfd+EGgaGkka6eXuqe7LtBX4QpAnE/tf LkjpH4Cno05i1FFICzv8oLxTiK6aYn7Xu4ZccRb4eN645Hfl6W/0Jg+zAuq5zYt9fyvz qQE0t/lDgkJ0J8wk4cyswe0HONJxKNy0t3ElEdvrf6f08wIiu/rOVMVZ5ylHcH6kGFER 3bfQ== 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=OH445ysdzmR/6X4//W4FphZ3nFgmJO7HaScUHltGfzw=; b=xbxaqUVcuWbshDXo8i3fdmNzx7Qccsu92bcYCjNBIsbR/ARqzrbQkkpuoMgKSia6gm zsXTBal7V5qSdBKhWNX6Hs8/ND1dXjPcW7L3STj+XI6EAaJYWRlxL5c1tfjYBDgpjO1j FD2g6tSkmWlRbKJ4qwrHTdM8wp0/WwycsbkZYIBsG1xH/GADrWNtcJNOja0RTxMi65eJ /A7B4d8LZ9hTxeWmBnSlR0uzb25JvFWfxFQPwnAZNryjO/XAEywU7du9MsT95k4xUj7S S6zuXi9fsSchqhAdAEt0GZis4lolJUkdoh6aNhAoqjIFEuG6f8sgp4vqiS4vAIwIVF88 bgdQ== X-Gm-Message-State: AOAM532hUIISSdbC6p0Hjv2NgB43XKa/vvVpt23afs6UWEDw7Hrw9QQ0 XTrVskHMB5AcbU+1HWtFTvIG4TFkBiLO9yEKzzo= X-Received: by 2002:a05:622a:1013:b0:2e1:c9c0:9831 with SMTP id d19-20020a05622a101300b002e1c9c09831mr10806922qte.245.1649322017903; Thu, 07 Apr 2022 02:00:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zhaoyang Huang Date: Thu, 7 Apr 2022 16:59:50 +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 Thu, Apr 7, 2022 at 3:40 PM Michal Hocko wrote: > > On Wed 06-04-22 10:11:19, Zhaoyang Huang wrote: > > 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. > > This means that limits are altered even if there is memory to be > reclaimed from other memcgs. Why? How does this line up with the > basic property of the low limit to act as a protection from the reclaim? ok, partially understand. I would like to say that low's original definition under this patch has changed, says the calculated low just provide protection when the psi value is lower than the setting and will introduce reclaiming if it exceed. It also can be seen from the bellowing latest test result(same as previous test but without mlock), which says that the memcg with fixed low will push back the reclaim to global LRU while keeping psi to be high. Please be noticed that the low will be updated when usage raise up over it which means resume the protection again when the memcg become active. psi(global=1GB) max stable psi(global=2GB) max stable Low=400MB some=18 full=11 700MB 600MB some=20 full=16 400MB 400MB Low=500MB some=18 full=13 680MB 540MB some=27 full=17 500MB 500MB patch setting1 some=19 full=13 863MB 740MB some=15 full=10 500MB 500MB patch setting1 some=14 full=11 640MB 470MB some=20 full=12 360MB 320MB > > > > I think it would be also helpful to describe the high level semantic of > > > this feature. > > Please focus on this part. Without a high level semantic explained we > will not move forward. > -- > Michal Hocko > SUSE Labs