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 68DB4C433EF for ; Thu, 23 Jun 2022 08:01:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB7728E013B; Thu, 23 Jun 2022 04:01:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D66E08E0115; Thu, 23 Jun 2022 04:01:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2E188E013B; Thu, 23 Jun 2022 04:01:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AC29C8E0115 for ; Thu, 23 Jun 2022 04:01:13 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7C84F34B5C for ; Thu, 23 Jun 2022 08:01:13 +0000 (UTC) X-FDA: 79608755226.06.50A72A1 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf25.hostedemail.com (Postfix) with ESMTP id 2288BA00A9 for ; Thu, 23 Jun 2022 08:01:11 +0000 (UTC) Received: by mail-pg1-f174.google.com with SMTP id l4so18392579pgh.13 for ; Thu, 23 Jun 2022 01:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/NhZQbybYNV4ql8AOBzyFwwUBzfnXwzuK978gk1Ml84=; b=EUpa10GU56rpjLInFt0K+URdhNeHMdvg4AN6jf+AMBMviABMHT1I0SBwU+Xs1g7K50 sFyGdWhzK07Xx9N6FvB9REH+0u8NeCuoILHXMgr714h8j8xr1MauiV8qUAwHpr430U58 ikETNoPHCZ/RyoriLqyH5HNcscl7k8rrf1IAuPpQjOrsWaHT23yTzk4dY5QY+qwTyAAr xVP45eEmutDouz9p3hP1FrBmD9dtLeGmOmmOIwAyiBGkXGMuL9umsqr9iwx67cZdDLk/ //2XGqAJxgkktVCmbkp6sBnAfMXz+/IJPmLmSoKXDDIeVT7FZQMCKBGtIBxNYwifmB9U YsYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/NhZQbybYNV4ql8AOBzyFwwUBzfnXwzuK978gk1Ml84=; b=2KrqeMhdz4gGDyAyYhL/sn0P62DxW0dkbt5mVszIYilT+yFlBPTDniR8hbJEJdZCdi t5lScisThqwsdt1yf26dZV5MTPqiSjNwiSu4rAiK3QEAG9iGpkBnRL0cnyGCcAzs8x09 bo8KingkxtPgpLx0dMYYWwXht2yTYrOdgrdNsHn2CaDvk6xh4R7nKDe7NP9MbSFznG8N gKDMYGz5q+bB4E9aEdf5BxMWbw5lFEU1Y7wIdM4Uw74ICHQKLUWeNwlve2ppXUIbN5Bg sN9iMeFRIMwB5Yo965kAACctwGELf3qWTfN8Ri1XQ2GZQLMXerW+F6CST4dEYFgTaAtf xxRQ== X-Gm-Message-State: AJIora8dp4KArEZ+321vmZlp2E7JgFNpYxO9dQCCye7tAqFTx6PihthC g/DkSKw1QH/P4anXz1jOhErqWKWD1gWjTSLF X-Google-Smtp-Source: AGRyM1vOzBVmK7KJ8WhZ4KuGOnQR+9dBKSXovcMy7x+Ju4/PNpklw+ENnzOw2nwzZ2mdnREPi9b4cA== X-Received: by 2002:a05:6a00:140a:b0:4e0:54d5:d01 with SMTP id l10-20020a056a00140a00b004e054d50d01mr39340514pfu.20.1655971270104; Thu, 23 Jun 2022 01:01:10 -0700 (PDT) Received: from n248-144-242.byted.org. ([121.30.179.32]) by smtp.gmail.com with ESMTPSA id v5-20020a17090a0c8500b001e2da6766ecsm1209105pja.31.2022.06.23.01.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 01:01:09 -0700 (PDT) From: zhouchuyi To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, zhouchuyi Subject: [PATCH] mm/vmscan: add pgstall to memcg Date: Thu, 23 Jun 2022 16:01:03 +0800 Message-Id: <20220623080103.156628-1-zhouchuyi@bytedance.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655971273; a=rsa-sha256; cv=none; b=mJTkWLEfSrkVqIPamAjQQUyvsburA+/Ko5fgO78IDgddAHNFjFYBh1bTIpNRUkqNrMRu0w JTEhl6GDHsPs2ZgBgaD+SnRqn7dKanOxPEg7s7QEejKWBFOAEd+AQCIi4AsdjfIah/Fyif RWFf1K8MHlkTIwgrWVEjcHXMNu2AMHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655971273; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=/NhZQbybYNV4ql8AOBzyFwwUBzfnXwzuK978gk1Ml84=; b=tANywWKFks050fMPHVKANjMaO+rqISbNy+8zKkUI7LMDpxGpgqOxE66/GbfTywpYzYuVxi VBKNO+IbuwDzrR+XYRaBNjVkMUAPQc1XlK9qUVTX+/F43ZZixAgp6+311jZpQ02ixYiowo qaFg9SnWdlt+oIKKOUf5FhaVMXs+bHI= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=EUpa10GU; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf25.hostedemail.com: domain of zhouchuyi@bytedance.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=zhouchuyi@bytedance.com X-Rspam-User: X-Rspamd-Queue-Id: 2288BA00A9 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=EUpa10GU; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf25.hostedemail.com: domain of zhouchuyi@bytedance.com designates 209.85.215.174 as permitted sender) smtp.mailfrom=zhouchuyi@bytedance.com X-Stat-Signature: w7g8j4deaok3x7zwngg8xdjhf7cs1jcy X-Rspamd-Server: rspam09 X-HE-Tag: 1655971271-679131 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: Add pgstall to indicate the times of entering direct reclaim of memcg, use the item of ALLOCSTALL_NORMAL in vmevents to save the data. Signed-off-by: zhouchuyi --- Hi, I notice memcg uses some items to indicate the situation of direct reclaim in memory.stat,such as pgsteal and pgscan. I think there is no harm in adding another item to show the times of entering direct reclaim. Thanks, zhouchuyi Documentation/admin-guide/cgroup-v2.rst | 7 +++++-- mm/memcontrol.c | 2 ++ mm/vmscan.c | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst index 176298f2f..44c5b15bd 100644 --- a/Documentation/admin-guide/cgroup-v2.rst +++ b/Documentation/admin-guide/cgroup-v2.rst @@ -1447,8 +1447,11 @@ PAGE_SIZE multiple when read back. pgsteal (npn) Amount of reclaimed pages - - pgactivate (npn) + + pgstall (npn) + Number of entering direct reclaim + + pgactivate (npn) Amount of pages moved to the active LRU list pgdeactivate (npn) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index abec50f31..f407084b2 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1505,6 +1505,8 @@ static char *memory_stat_format(struct mem_cgroup *memcg) seq_buf_printf(&s, "pgscan %lu\n", memcg_events(memcg, PGSCAN_KSWAPD) + memcg_events(memcg, PGSCAN_DIRECT)); + seq_buf_printf(&s, "pgstall %lu\n", + memcg_events(memcg, ALLOCSTALL_NORMAL)); seq_buf_printf(&s, "pgsteal %lu\n", memcg_events(memcg, PGSTEAL_KSWAPD) + memcg_events(memcg, PGSTEAL_DIRECT)); diff --git a/mm/vmscan.c b/mm/vmscan.c index f7d9a683e..107cec59a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3532,7 +3532,10 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, if (!cgroup_reclaim(sc)) __count_zid_vm_events(ALLOCSTALL, sc->reclaim_idx, 1); - + else { + count_memcg_events(sc->target_mem_cgroup, + ALLOCSTALL_NORMAL, 1); + } do { vmpressure_prio(sc->gfp_mask, sc->target_mem_cgroup, sc->priority); -- 2.20.1