From: Dmitry Rokosov <ddrokosov@salutedevices.com>
To: Michal Hocko <mhocko@suse.com>
Cc: <rostedt@goodmis.org>, <mhiramat@kernel.org>,
<hannes@cmpxchg.org>, <roman.gushchin@linux.dev>,
<shakeelb@google.com>, <muchun.song@linux.dev>,
<akpm@linux-foundation.org>, <kernel@sberdevices.ru>,
<rockosov@gmail.com>, <cgroups@vger.kernel.org>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
<bpf@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] mm: memcg: introduce new event to trace shrink_memcg
Date: Wed, 22 Nov 2023 21:57:27 +0300 [thread overview]
Message-ID: <20231122185727.vcfg56d7sekdfhnm@CAB-WSD-L081021> (raw)
In-Reply-To: <ZV4BK0wbUAZBIhmA@tiehlicka>
On Wed, Nov 22, 2023 at 02:24:59PM +0100, Michal Hocko wrote:
> On Wed 22-11-23 13:58:36, Dmitry Rokosov wrote:
> > Hello Michal,
> >
> > Thank you for the quick review!
> >
> > On Wed, Nov 22, 2023 at 11:23:24AM +0100, Michal Hocko wrote:
> > > On Wed 22-11-23 13:01:56, Dmitry Rokosov wrote:
> > > > The shrink_memcg flow plays a crucial role in memcg reclamation.
> > > > Currently, it is not possible to trace this point from non-direct
> > > > reclaim paths.
> > >
> > > Is this really true? AFAICS we have
> > > mm_vmscan_lru_isolate
> > > mm_vmscan_lru_shrink_active
> > > mm_vmscan_lru_shrink_inactive
> > >
> > > which are in the vry core of the memory reclaim. Sure post processing
> > > those is some work.
> >
> > Sure, you are absolutely right. In the usual scenario, the memcg
> > shrinker utilizes two sub-shrinkers: slab and LRU. We can enable the
> > tracepoints you mentioned and analyze them. However, there is one
> > potential issue. Enabling these tracepoints will trigger the reclaim
> > events show for all pages. Although we can filter them per pid, we
> > cannot filter them per cgroup. Nevertheless, there are times when it
> > would be extremely beneficial to comprehend the effectiveness of the
> > reclaim process within the relevant cgroup. For this reason, I am adding
> > the cgroup name to the memcg tracepoints and implementing a cumulative
> > tracepoint for memcg shrink (LRU + slab)."
>
> I can see how printing memcg in mm_vmscan_memcg_reclaim_begin makes it
> easier to postprocess per memcg reclaim. But you could do that just by
> adding that to mm_vmscan_memcg_reclaim_{begin, end}, no? Why exactly
> does this matter for kswapd and other global reclaim contexts?
From my point of view, kswapd and other non-direct reclaim paths are
important for memcg analysis because they also influence the memcg
reclaim statistics.
The tracepoint mm_vmscan_memcg_reclaim_{begin, end} is called from the
direct memcg reclaim flow, such as:
- a direct write to the 'reclaim' node
- changing 'max' and 'high' thresholds
- raising the 'force_empty' mechanism
- the charge path
- etc.
However, it doesn't cover global reclaim contexts, so it doesn't provide
us with the full memcg reclaim statistics.
--
Thank you,
Dmitry
next prev parent reply other threads:[~2023-11-22 18:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-22 10:01 [PATCH v2 0/2] mm: memcg: improve vmscan tracepoints Dmitry Rokosov
2023-11-22 10:01 ` [PATCH v2 1/2] mm: memcg: print out cgroup name in the memcg tracepoints Dmitry Rokosov
2023-11-23 7:21 ` Shakeel Butt
2023-11-23 8:03 ` Dmitry Rokosov
2023-11-23 8:15 ` Shakeel Butt
2023-11-23 8:45 ` Dmitry Rokosov
2023-11-23 11:21 ` Dmitry Rokosov
[not found] ` <20231122100156.6568-3-ddrokosov@salutedevices.com>
2023-11-22 10:23 ` [PATCH v2 2/2] mm: memcg: introduce new event to trace shrink_memcg Michal Hocko
2023-11-22 10:58 ` Dmitry Rokosov
2023-11-22 13:24 ` Michal Hocko
2023-11-22 18:57 ` Dmitry Rokosov [this message]
2023-11-23 11:26 ` Dmitry Rokosov
2023-11-27 9:25 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231122185727.vcfg56d7sekdfhnm@CAB-WSD-L081021 \
--to=ddrokosov@salutedevices.com \
--cc=akpm@linux-foundation.org \
--cc=bpf@vger.kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kernel@sberdevices.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhiramat@kernel.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=rockosov@gmail.com \
--cc=roman.gushchin@linux.dev \
--cc=rostedt@goodmis.org \
--cc=shakeelb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox