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 3D956C433F5 for ; Thu, 7 Apr 2022 09:00:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AC4E16B0071; Thu, 7 Apr 2022 05:00:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A25CD6B0073; Thu, 7 Apr 2022 05:00:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89F776B0074; Thu, 7 Apr 2022 05:00:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 738916B0071 for ; Thu, 7 Apr 2022 05:00:29 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 45711123D52 for ; Thu, 7 Apr 2022 09:00:19 +0000 (UTC) X-FDA: 79329486558.06.FB81055 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by imf03.hostedemail.com (Postfix) with ESMTP id B60F220002 for ; Thu, 7 Apr 2022 09:00:18 +0000 (UTC) Received: by mail-qt1-f172.google.com with SMTP id o15so7539730qtv.8 for ; 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=1vfvo5GtFhvjwCP65PB2KOI9Da9aZ2yXIG0El6gUFgpwnpkwan00moPOZM4S/qNjF9 LCJM570Q82Q4cQsi04cwwF2hy1LCPczJLQh8ECVSYt/Z6MDwP1jPQwhc6ovmFE6waEkc KGY6ENpm/o8bsFc127/aAAPGvLkDs8Rjhth3gFB4mRv+abWqWaw5KHm0TemvxTSUY88b ywG3c3OdzK9VjK6vyp9nz3jWDT9Q2ux2GHGwGGB9w+8Fad+nwJMr2JAuqkMkzrB+1agb caX4DZ409zO5rhVMC/jgtoMflGSPeBfxqjxm5M5egnQyQHu1sTinGmmgUMB4+yZ5PYVS c/Zg== X-Gm-Message-State: AOAM533uhb66TCYe2l9b3UHV+yIf0SWUf7hyr75UFhcHrHY26F2bpneB SU4il2aq7KZE+e32fhX/YUy94DPD283phkJ3jJY= X-Google-Smtp-Source: ABdhPJxkJcaz/OQCc+qvAyLt1HwRQ64uhkf6n9dqvP50oc4eIHNr8Q3rR3052T537/f3WHSshWmFYgHuaFNt7O3iipA= 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-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B60F220002 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=A2BZMU75; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf03.hostedemail.com: domain of huangzhaoyang@gmail.com designates 209.85.160.172 as permitted sender) smtp.mailfrom=huangzhaoyang@gmail.com X-Stat-Signature: jzr94qogr8guf8nnc78bu4n8dm45wkrf X-HE-Tag: 1649322018-269203 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 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