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 X-Spam-Level: X-Spam-Status: No, score=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24317C4338F for ; Fri, 20 Aug 2021 06:53:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF5896101C for ; Fri, 20 Aug 2021 06:53:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AF5896101C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 48B806B0071; Fri, 20 Aug 2021 02:53:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 43AC08D0001; Fri, 20 Aug 2021 02:53:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 329726B0073; Fri, 20 Aug 2021 02:53:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 137A36B0071 for ; Fri, 20 Aug 2021 02:53:18 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B6B2A2B349 for ; Fri, 20 Aug 2021 06:53:17 +0000 (UTC) X-FDA: 78494542434.23.7AD1EF3 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf12.hostedemail.com (Postfix) with ESMTP id 80B0810000A9 for ; Fri, 20 Aug 2021 06:53:17 +0000 (UTC) Received: by mail-ed1-f47.google.com with SMTP id b7so12531852edu.3 for ; Thu, 19 Aug 2021 23:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZV0k7Tiq6KI/tbutIIDiQigPzOBPpHO6yPvk1gd0d5k=; b=M0Da5hEGnwOCOs+9ib49H1x8sY+AAW+vbbh7qhBDFsF1ysrVEJJuUE9wSZ6bR+Yx28 rhJrV2zL4eANa8t6Vrobm/GZhA2n1SzbLMmjSC6j9OpHThk4bvEWukaqDlcxpffxelW8 Z8s0sv0zg6LWOHPHxvb0PQMnpcSckb6snYdLB60ld/v6h4YzabwrdCXnrK5ohJznKtzQ O6r2Ob/s19ifKQTQOLgeob0y0sCAQvkisWdoPeLxHkRTFlzxTiwqviRYyvma5GcWxlga dmm+YumExxXwnl+nc5OYZT1iGuiiE2FZTDwuJp5Hq5QmMgGxSlBA5XJHZCICh6HLqtAF CiCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZV0k7Tiq6KI/tbutIIDiQigPzOBPpHO6yPvk1gd0d5k=; b=ak7FkC7LDCp0L7UHaBIydJOL7l/grICzu2AdjurG5RvOaNxUjJ4N3074MmmrhFv62X JzCyOfJvV4Bu9Wi5dJLooUwX07SppRMauMs6rDflgN9Bo7xH5Co9Jci66AVmRGIeiSjd +5e6vOkltcnwtwHgYKTkag7qH0bDh9rnIkV0zg0e5f3OmN/pRaEzuSOI+0V2mC1B8Q1Z ky16VjUzHP+OktY2sr15zqcluTNaiwAGldmpX2SISv2Jnc+bO3GKV7xNRJAtkx5yroRL vAg6JIe/cJwP7ISpf/ghPz6IlpLepMfw5Ra7sbXkI2r36im+bnV5aEhcGbiXPUsPpPBU F1Og== X-Gm-Message-State: AOAM531dijvYQ9KDZsGTs3Ca3/mUoa3y4qfOcq6KjwoEINifX3YG9Eaj hx7qqAudoc9UP1/tYlmcSWoAqYIuKl1TXzkVZMw= X-Google-Smtp-Source: ABdhPJyUhHkMl7/Q9bGcIKdKvKoDfzstUmLlaEJbEonjdh6ZM40Ovy5v9kwJV21LF2yyDkuKJXqgUrYVofqxKdGCUjA= X-Received: by 2002:a05:6402:1606:: with SMTP id f6mr20556903edv.111.1629442396266; Thu, 19 Aug 2021 23:53:16 -0700 (PDT) MIME-Version: 1.0 References: <20210819163056.GA9764@haolee.github.io> In-Reply-To: From: Hao Lee Date: Fri, 20 Aug 2021 14:53:05 +0800 Message-ID: Subject: Re: [PATCH] mm: vmscan: consistent update to pgdeactivate and pgactivate To: Shakeel Butt Cc: Andrew Morton , Johannes Weiner , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 80B0810000A9 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=M0Da5hEG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of haoleeswjtu@gmail.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=haoleeswjtu@gmail.com X-Rspamd-Server: rspam04 X-Stat-Signature: yoio7ffdsy33onssw6xawwornt4c5nem X-HE-Tag: 1629442397-956448 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000019, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Aug 20, 2021 at 4:27 AM Shakeel Butt wrote: > > On Thu, Aug 19, 2021 at 9:31 AM Hao Lee wrote: > > > > After the commit 912c05720f00 ("mm: vmscan: consistent update to > > pgrefill"), pgrefill is consistent with pgscan and pgsteal. Only under > > global reclaim, are they updated at system level. Apart from that, > > pgdeactivate is often used together with pgrefill to measure the > > deactivation efficiency and pgactivate is used together with > > pgscan to measure the reclaim efficiency. It's also necessary to > > make pgdeactivate and pgactivate consistent with this rule. > > > > Signed-off-by: Hao Lee > > pgactivate and pgdeactivate are also updated in code paths other than > memory reclaim like mark_page_accessed() or madvise(COLD). Wouldn't > that impact your analysis of these metrics as well? Thanks for pointing out this. These paths indeed increase the pgdeactivate and pgactivate counter, but they all can be seen as system-level. On the other hand, the deactivation and activation in the cgroup try_charge() direct reclaim path is cgroup-level, which is caused by artificial limits. If the system memory pressure is low, but a cgroup is going through aggressive memory reclaim, then the two metrics will increase continuously in both vmstat and memory.stat. I think this is not reasonable. Suppose we exclude them from the cgroup direct reclaim path. In that case, we can determine if the system level memory reclaim is hard to make progress by using pgdeactivate/pgrefill and pgactivate/pgscan roughly ("roughly" means we temporarily ignore deactivation and activation in other paths). One can still get these metrics in both system-level and cgroup-level through memory.stat. Regards, Hao Lee