linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: vmscan: consistent update to pgrefill
@ 2020-07-11  1:14 Shakeel Butt
  2020-07-11  1:54 ` Yafang Shao
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Shakeel Butt @ 2020-07-11  1:14 UTC (permalink / raw)
  To: Johannes Weiner, Roman Gushchin, Michal Hocko, Yafang Shao, Chris Down
  Cc: Andrew Morton, linux-mm, linux-kernel, Shakeel Butt

The vmstat pgrefill is useful together with pgscan and pgsteal stats to
measure the reclaim efficiency. However vmstat's pgrefill is not updated
consistently at system level. It gets updated for both global and memcg
reclaim however pgscan and pgsteal are updated for only global reclaim.
So, update pgrefill only for global reclaim. If someone is interested in
the stats representing both system level as well as memcg level reclaim,
then consult the root memcg's memory.stat instead of /proc/vmstat.

Signed-off-by: Shakeel Butt <shakeelb@google.com>
---
 mm/vmscan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 5215840ee217..4167b0cc1784 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2030,7 +2030,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
 
 	__mod_node_page_state(pgdat, NR_ISOLATED_ANON + file, nr_taken);
 
-	__count_vm_events(PGREFILL, nr_scanned);
+	if (!cgroup_reclaim(sc))
+		__count_vm_events(PGREFILL, nr_scanned);
 	__count_memcg_events(lruvec_memcg(lruvec), PGREFILL, nr_scanned);
 
 	spin_unlock_irq(&pgdat->lru_lock);
-- 
2.27.0.383.g050319c2ae-goog



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: vmscan: consistent update to pgrefill
  2020-07-11  1:14 [PATCH] mm: vmscan: consistent update to pgrefill Shakeel Butt
@ 2020-07-11  1:54 ` Yafang Shao
  2020-07-11  2:31 ` Roman Gushchin
  2020-07-11 10:07 ` Chris Down
  2 siblings, 0 replies; 5+ messages in thread
From: Yafang Shao @ 2020-07-11  1:54 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Johannes Weiner, Roman Gushchin, Michal Hocko, Chris Down,
	Andrew Morton, Linux MM, LKML

On Sat, Jul 11, 2020 at 9:15 AM Shakeel Butt <shakeelb@google.com> wrote:
>
> The vmstat pgrefill is useful together with pgscan and pgsteal stats to
> measure the reclaim efficiency. However vmstat's pgrefill is not updated
> consistently at system level. It gets updated for both global and memcg
> reclaim however pgscan and pgsteal are updated for only global reclaim.
> So, update pgrefill only for global reclaim. If someone is interested in
> the stats representing both system level as well as memcg level reclaim,
> then consult the root memcg's memory.stat instead of /proc/vmstat.
>
> Signed-off-by: Shakeel Butt <shakeelb@google.com>

Acked-by: Yafang Shao <laoar.shao@gmail.com>

> ---
>  mm/vmscan.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 5215840ee217..4167b0cc1784 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2030,7 +2030,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
>
>         __mod_node_page_state(pgdat, NR_ISOLATED_ANON + file, nr_taken);
>
> -       __count_vm_events(PGREFILL, nr_scanned);
> +       if (!cgroup_reclaim(sc))
> +               __count_vm_events(PGREFILL, nr_scanned);
>         __count_memcg_events(lruvec_memcg(lruvec), PGREFILL, nr_scanned);
>
>         spin_unlock_irq(&pgdat->lru_lock);
> --
> 2.27.0.383.g050319c2ae-goog
>


-- 
Thanks
Yafang


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: vmscan: consistent update to pgrefill
  2020-07-11  1:14 [PATCH] mm: vmscan: consistent update to pgrefill Shakeel Butt
  2020-07-11  1:54 ` Yafang Shao
@ 2020-07-11  2:31 ` Roman Gushchin
  2020-07-11  3:24   ` Shakeel Butt
  2020-07-11 10:07 ` Chris Down
  2 siblings, 1 reply; 5+ messages in thread
From: Roman Gushchin @ 2020-07-11  2:31 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Johannes Weiner, Michal Hocko, Yafang Shao, Chris Down,
	Andrew Morton, linux-mm, linux-kernel

On Fri, Jul 10, 2020 at 06:14:59PM -0700, Shakeel Butt wrote:
> The vmstat pgrefill is useful together with pgscan and pgsteal stats to
> measure the reclaim efficiency. However vmstat's pgrefill is not updated
> consistently at system level. It gets updated for both global and memcg
> reclaim however pgscan and pgsteal are updated for only global reclaim.
> So, update pgrefill only for global reclaim. If someone is interested in
> the stats representing both system level as well as memcg level reclaim,
> then consult the root memcg's memory.stat instead of /proc/vmstat.
> 
> Signed-off-by: Shakeel Butt <shakeelb@google.com>

So you went into the opposite direction from the "previous version"
( https://lkml.org/lkml/2020/5/7/1464 ) ?

Acked-by: Roman Gushchin <guro@fb.com>

Thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: vmscan: consistent update to pgrefill
  2020-07-11  2:31 ` Roman Gushchin
@ 2020-07-11  3:24   ` Shakeel Butt
  0 siblings, 0 replies; 5+ messages in thread
From: Shakeel Butt @ 2020-07-11  3:24 UTC (permalink / raw)
  To: Roman Gushchin
  Cc: Johannes Weiner, Michal Hocko, Yafang Shao, Chris Down,
	Andrew Morton, Linux MM, LKML

On Fri, Jul 10, 2020 at 7:32 PM Roman Gushchin <guro@fb.com> wrote:
>
> On Fri, Jul 10, 2020 at 06:14:59PM -0700, Shakeel Butt wrote:
> > The vmstat pgrefill is useful together with pgscan and pgsteal stats to
> > measure the reclaim efficiency. However vmstat's pgrefill is not updated
> > consistently at system level. It gets updated for both global and memcg
> > reclaim however pgscan and pgsteal are updated for only global reclaim.
> > So, update pgrefill only for global reclaim. If someone is interested in
> > the stats representing both system level as well as memcg level reclaim,
> > then consult the root memcg's memory.stat instead of /proc/vmstat.
> >
> > Signed-off-by: Shakeel Butt <shakeelb@google.com>
>
> So you went into the opposite direction from the "previous version"
> ( https://lkml.org/lkml/2020/5/7/1464 ) ?
>

Yes because we already had those stats in the root memcg and exposing
root memcg's memory.stat resolved the issue.

> Acked-by: Roman Gushchin <guro@fb.com>

Thanks a lot.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: vmscan: consistent update to pgrefill
  2020-07-11  1:14 [PATCH] mm: vmscan: consistent update to pgrefill Shakeel Butt
  2020-07-11  1:54 ` Yafang Shao
  2020-07-11  2:31 ` Roman Gushchin
@ 2020-07-11 10:07 ` Chris Down
  2 siblings, 0 replies; 5+ messages in thread
From: Chris Down @ 2020-07-11 10:07 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Johannes Weiner, Roman Gushchin, Michal Hocko, Yafang Shao,
	Andrew Morton, linux-mm, linux-kernel

Shakeel Butt writes:
>The vmstat pgrefill is useful together with pgscan and pgsteal stats to
>measure the reclaim efficiency. However vmstat's pgrefill is not updated
>consistently at system level. It gets updated for both global and memcg
>reclaim however pgscan and pgsteal are updated for only global reclaim.
>So, update pgrefill only for global reclaim. If someone is interested in
>the stats representing both system level as well as memcg level reclaim,
>then consult the root memcg's memory.stat instead of /proc/vmstat.
>
>Signed-off-by: Shakeel Butt <shakeelb@google.com>

Acked-by: Chris Down <chris@chrisdown.name>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-11 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-11  1:14 [PATCH] mm: vmscan: consistent update to pgrefill Shakeel Butt
2020-07-11  1:54 ` Yafang Shao
2020-07-11  2:31 ` Roman Gushchin
2020-07-11  3:24   ` Shakeel Butt
2020-07-11 10:07 ` Chris Down

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox