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 994C8C43334 for ; Tue, 12 Jul 2022 09:28:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D0E6F94005A; Tue, 12 Jul 2022 05:28:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C9536940033; Tue, 12 Jul 2022 05:28:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5BCA94005A; Tue, 12 Jul 2022 05:28:58 -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 A3017940033 for ; Tue, 12 Jul 2022 05:28:58 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 766D860AA7 for ; Tue, 12 Jul 2022 09:28:58 +0000 (UTC) X-FDA: 79677923556.12.EF232CA Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf09.hostedemail.com (Postfix) with ESMTP id 3289814006C for ; Tue, 12 Jul 2022 09:28:57 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id b8so5703063pjo.5 for ; Tue, 12 Jul 2022 02:28:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:to:cc:references :from:in-reply-to:content-transfer-encoding; bh=8GG23ZMUTC9FzvARJbuh7uu/vSwKNGl6yVQnUSO2cRs=; b=ykJFoz/kbt78uegZkFlzSnETZN+l1rCR1EtotQQIaFLsgrH/V+3zqpvXu8luDoOSvl 8D9095/YyXrmN/W4SLVMWcfPGcXJWh5rY65G+1X64FGIt9KvT2jM4peSgQ7PEbozCNii JE0lswYnAGw/nGYx4/lk39VJ0DUEw2dw9TSmIyKsjMdRxxFV9kGNSDFhIpfRuFQNJ9DF mM1YC1RczHxQH1bm1AsqIY6F2DGUU2hKZ8IKBlUUaRXDFehiVEpjSOXD6vEka65T0jtz gpxcHJWFowA63YFZvzd3J5ZLaMUAfHANZrFCoJuqAZ3WEKaueZPx99mHODLR1IlPeZ7w nwhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :to:cc:references:from:in-reply-to:content-transfer-encoding; bh=8GG23ZMUTC9FzvARJbuh7uu/vSwKNGl6yVQnUSO2cRs=; b=MSFIsG/Ufua++gMYTc6DKOVsCx10O3sDgoVBIw7vaLiw+KTi+IhNqHL6P+ieEYTvQL b9KWTW0j4sYzsg0/9A7TdUzDD1s+ezUB7h1LffIs4qIzOAxC8jda9XmPg11bTzshq5OB Vm3BBuaDot2nsSnDE84PmVFZLpOhjsqZnhejE6F9YPMRWhRIactZj3vjJZs7IX6NFn+b s2JRWKH0gne4Ld/Jch/tGIy1qtCCmg5fQMqDNGiMDELzlt2KuDouK5EJe27TMDWGLxUP kOdtrlRxMNFzr2FHz6HBdBTp1p1vwJhn5xdbpN3cG7O0eJMpgkAA3loxrHCM9tp9IY08 I02Q== X-Gm-Message-State: AJIora/C5W224fsVrC8jNWp2aMUQMfm6CP07XdB0H6+WK9x12NcF8lFQ fKlSaU3vTQw8YjqwGOSNI49jNA== X-Google-Smtp-Source: AGRyM1vCRY4J7BC0Mgg0gci+QD+/HPwcFILvYlRL3b12Yzq6wUxPajEpGTdMMitwxk2E9ikWdvtlVg== X-Received: by 2002:a17:90a:c906:b0:1f0:47ed:59bd with SMTP id v6-20020a17090ac90600b001f047ed59bdmr3269235pjt.40.1657618135976; Tue, 12 Jul 2022 02:28:55 -0700 (PDT) Received: from [10.85.119.42] ([139.177.225.235]) by smtp.gmail.com with ESMTPSA id a125-20020a624d83000000b00528a4238eadsm6477566pfb.13.2022.07.12.02.28.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Jul 2022 02:28:55 -0700 (PDT) Message-ID: <333e16e8-95a8-20e4-6be4-4cc3a602c7b2@bytedance.com> Date: Tue, 12 Jul 2022 17:28:50 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] mm/vmscan: add pgstall to memcg To: Andrew Morton Cc: linux-mm@kvack.org, Michal Hocko , Roman Gushchin , Johannes Weiner , Shakeel Butt , Muchun Song References: <20220623080103.156628-1-zhouchuyi@bytedance.com> <20220624134218.e25104d902f7fde209728a23@linux-foundation.org> From: Chuyi Zhou In-Reply-To: <20220624134218.e25104d902f7fde209728a23@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657618138; a=rsa-sha256; cv=none; b=Rp8a8CwZKLaSzE26usX9yDMtAcleCEzD/eOPG4yjV4P7VodDUvALScwzhCRei24VEHGjgM Y0RT1/Onu7VtPb7eDJzsYFlOHKZiUMc4RdHHS+IwijWVIGqtDoc51TeSaOmSBuHugNRnOx bXZV8OrFhhCmG5qT4QNFanT87V2aC4o= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="ykJFoz/k"; spf=pass (imf09.hostedemail.com: domain of zhouchuyi@bytedance.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=zhouchuyi@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657618138; 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:in-reply-to:references:references:dkim-signature; bh=8GG23ZMUTC9FzvARJbuh7uu/vSwKNGl6yVQnUSO2cRs=; b=BZC3HaRdV/KGhfCYsfLyanQmSpAxDqZ+B4K7cLEB4dGTQn9inw0xR7ZoSwg8fe/gBNuAqh qyxw47l1sbGqrK2ZpyVYphGncHVigpijs4oa7FntfggNq5T/gaEmHusaTPb8dIzU2DTfkb v0sj4qw4U3YQseUf+0u3Sqq2Kqcmr8A= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3289814006C X-Rspam-User: X-Stat-Signature: q8aeyfyhjb15o6u96oc5hozxauwq61ta Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="ykJFoz/k"; spf=pass (imf09.hostedemail.com: domain of zhouchuyi@bytedance.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=zhouchuyi@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-HE-Tag: 1657618137-905457 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: 在 2022/6/25 上午4:42, Andrew Morton 写道: > (cc memcg developers) > On Thu, 23 Jun 2022 16:01:03 +0800 zhouchuyi wrote: > >> 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. >> > > Why do you consider this useful? Do you have a use case? If so, > please describe it in detail. > Since there are allocstall in proc/vmstat which indicate the number of entering direct reclaim of !cgroup_reclaim, So I think it maybe useful. For example, users could adjust memory.max to prevent entering direct reclaim through this item.So what do you think about it ? >> >> ... >> >> 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