All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg
@ 2019-04-09 13:13 Yafang Shao
  2019-04-09 13:25 ` Chris Down
  2019-04-09 17:55 ` Johannes Weiner
  0 siblings, 2 replies; 5+ messages in thread
From: Yafang Shao @ 2019-04-09 13:13 UTC (permalink / raw)
  To: hannes, mhocko, vdavydov.dev
  Cc: akpm, cgroups, linux-mm, shaoyafang, Yafang Shao

Now we count PGSCAN_KSWAPD and PGSCAN_DIRECT into one single item
'pgscan', that's not proper.

PGSCAN_DIRECT is triggered by the tasks in this memcg, which directly
indicates the memory status of this memcg;
while PGSCAN_KSWAPD is triggered by the kswapd(which always reflects the
system level memory status) and it happens to scan the pages in this
memcg.

So we should better split 'pgscan' into 'pgscan_direct' and
'pgscan_kswapd'.

BTW, softlimit reclaim will never happen in cgroup v2.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 mm/memcontrol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 10af4dd..abd17f8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5635,8 +5635,8 @@ static int memory_stat_show(struct seq_file *m, void *v)
 		   acc.vmstats[WORKINGSET_NODERECLAIM]);
 
 	seq_printf(m, "pgrefill %lu\n", acc.vmevents[PGREFILL]);
-	seq_printf(m, "pgscan %lu\n", acc.vmevents[PGSCAN_KSWAPD] +
-		   acc.vmevents[PGSCAN_DIRECT]);
+	seq_printf(m, "pgscan_direct %lu\n", acc.vmevents[PGSCAN_DIRECT]);
+	seq_printf(m, "pgscan_kswapd %lu\n", acc.vmevents[PGSCAN_KSWAPD]);
 	seq_printf(m, "pgsteal %lu\n", acc.vmevents[PGSTEAL_KSWAPD] +
 		   acc.vmevents[PGSTEAL_DIRECT]);
 	seq_printf(m, "pgactivate %lu\n", acc.vmevents[PGACTIVATE]);
-- 
1.8.3.1


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

* Re: [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg
  2019-04-09 13:13 [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg Yafang Shao
@ 2019-04-09 13:25 ` Chris Down
  2019-04-09 14:04   ` Yafang Shao
  2019-04-09 17:55 ` Johannes Weiner
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Down @ 2019-04-09 13:25 UTC (permalink / raw)
  To: Yafang Shao
  Cc: hannes, mhocko, vdavydov.dev, akpm, cgroups, linux-mm, shaoyafang

Hey Yafang,

Yafang Shao writes:
>-	seq_printf(m, "pgscan %lu\n", acc.vmevents[PGSCAN_KSWAPD] +
>-		   acc.vmevents[PGSCAN_DIRECT]);
>+	seq_printf(m, "pgscan_direct %lu\n", acc.vmevents[PGSCAN_DIRECT]);
>+	seq_printf(m, "pgscan_kswapd %lu\n", acc.vmevents[PGSCAN_KSWAPD]);

I don't think we can remove the overall pgscan counter now, we already have 
people relying on it in prod. At least from my perspective, this patch would be 
fine, as long as pgscan was kept.

Thanks,

Chris


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

* Re: [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg
  2019-04-09 13:25 ` Chris Down
@ 2019-04-09 14:04   ` Yafang Shao
  0 siblings, 0 replies; 5+ messages in thread
From: Yafang Shao @ 2019-04-09 14:04 UTC (permalink / raw)
  To: Chris Down
  Cc: Johannes Weiner, Michal Hocko, Vladimir Davydov, Andrew Morton,
	Cgroups, Linux MM, shaoyafang

On Tue, Apr 9, 2019 at 9:25 PM Chris Down <chris@chrisdown.name> wrote:
>
> Hey Yafang,
>
> Yafang Shao writes:
> >-      seq_printf(m, "pgscan %lu\n", acc.vmevents[PGSCAN_KSWAPD] +
> >-                 acc.vmevents[PGSCAN_DIRECT]);
> >+      seq_printf(m, "pgscan_direct %lu\n", acc.vmevents[PGSCAN_DIRECT]);
> >+      seq_printf(m, "pgscan_kswapd %lu\n", acc.vmevents[PGSCAN_KSWAPD]);
>
> I don't think we can remove the overall pgscan counter now, we already have
> people relying on it in prod. At least from my perspective, this patch would be
> fine, as long as pgscan was kept.
>

HI Chirs,

Thanks for your feedback.
I will keep 'pgscan' and only introduce 'pgscan_kswapd'.

Thanks
Yafang


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

* Re: [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg
  2019-04-09 13:13 [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg Yafang Shao
  2019-04-09 13:25 ` Chris Down
@ 2019-04-09 17:55 ` Johannes Weiner
  2019-04-10  1:16   ` Yafang Shao
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Weiner @ 2019-04-09 17:55 UTC (permalink / raw)
  To: Yafang Shao; +Cc: mhocko, vdavydov.dev, akpm, cgroups, linux-mm, shaoyafang

On Tue, Apr 09, 2019 at 09:13:43PM +0800, Yafang Shao wrote:
> Now we count PGSCAN_KSWAPD and PGSCAN_DIRECT into one single item
> 'pgscan', that's not proper.
> 
> PGSCAN_DIRECT is triggered by the tasks in this memcg, which directly
> indicates the memory status of this memcg;

PGSCAN_DIRECT occurs independent of cgroups when kswapd is overwhelmed
or when allocations don't pass __GFP_KSWAPD_RECLAIM. You'll get direct
reclaim inside memcgs that don't have a limit.


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

* Re: [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg
  2019-04-09 17:55 ` Johannes Weiner
@ 2019-04-10  1:16   ` Yafang Shao
  0 siblings, 0 replies; 5+ messages in thread
From: Yafang Shao @ 2019-04-10  1:16 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Michal Hocko, Vladimir Davydov, Andrew Morton, Cgroups, Linux MM,
	shaoyafang

On Wed, Apr 10, 2019 at 1:55 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> On Tue, Apr 09, 2019 at 09:13:43PM +0800, Yafang Shao wrote:
> > Now we count PGSCAN_KSWAPD and PGSCAN_DIRECT into one single item
> > 'pgscan', that's not proper.
> >
> > PGSCAN_DIRECT is triggered by the tasks in this memcg, which directly
> > indicates the memory status of this memcg;
>
> PGSCAN_DIRECT occurs independent of cgroups when kswapd is overwhelmed
> or when allocations don't pass __GFP_KSWAPD_RECLAIM. You'll get direct
> reclaim inside memcgs that don't have a limit.

Oh yes.
Plus PGSCAN_DIRECT may also triggered by the tasks in the parent memcg.

'pgscan' here only cares about the memory in this memcg, other than
the tasks in this memcg.
Seems we'd better introduce another counter to reflect the tasks in this memcg.

Thanks
Yafang


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

end of thread, other threads:[~2019-04-10  1:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 13:13 [PATCH] mm/memcontrol: split pgscan into direct and kswapd for memcg Yafang Shao
2019-04-09 13:25 ` Chris Down
2019-04-09 14:04   ` Yafang Shao
2019-04-09 17:55 ` Johannes Weiner
2019-04-10  1:16   ` Yafang Shao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.