linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: WARNINGs in set_task_reclaim_state with memory cgroup andfullmemory usage
@ 2019-08-24 13:05 Hillf Danton
  2019-08-27 11:51 ` Yafang Shao
  0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2019-08-24 13:05 UTC (permalink / raw)
  To: Yafang Shao
  Cc: Adric Blake, Andrew Morton, Kirill Tkhai, Johannes Weiner,
	Michal Hocko, Daniel Jordan, Yang Shi, Mel Gorman, Linux MM,
	LKML


On Sat, 24 Aug 2019 16:15:38 +0800 Yafang Shao wrote:
> 
> The memcg soft reclaim is called from kswapd reclam path and direct
> reclaim path,
> so why not pass the scan_control from the callsite in these two
> reclaim paths and use it in memcg soft reclaim ?
> Seems there's no specially reason that we must introduce a new
> scan_control here.
> 
To protect memcg from being over reclaimed?
Victim memcg is selected one after another in a fair way, and punished
by reclaiming one memcg a round no more than nr_to_reclaim ==
SWAP_CLUSTER_MAX pages. And so is the flip-flop from global to memcg
reclaiming. We can see similar protection activities in
commit a394cb8ee632 ("memcg,vmscan: do not break out targeted reclaim
without reclaimed pages") and
commit 2bb0f34fe3c1 ("mm: vmscan: do not iterate all mem cgroups for
global direct reclaim").

No preference seems in either way except for retaining
nr_to_reclaim == SWAP_CLUSTER_MAX and target_mem_cgroup == memcg.
> 
> I have checked the hisotry why this order check is introduced here.
> The first commit is 4e41695356fb ("memory controller: soft limit
> reclaim on contention"),
> but it didn't explained why.
> At the first glance it is reasonable to remove it, but we should
> understand why it was introduced at the first place.

Reclaiming order can not make much sense in soft-limit reclaiming
under the current protection.

Thanks to Adric Blake again.

Hillf



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

* Re: WARNINGs in set_task_reclaim_state with memory cgroup andfullmemory usage
  2019-08-24 13:05 WARNINGs in set_task_reclaim_state with memory cgroup andfullmemory usage Hillf Danton
@ 2019-08-27 11:51 ` Yafang Shao
  2019-08-27 13:29   ` WARNINGs in set_task_reclaim_state with memory cgroupandfullmemory usage Hillf Danton
  0 siblings, 1 reply; 4+ messages in thread
From: Yafang Shao @ 2019-08-27 11:51 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Adric Blake, Andrew Morton, Kirill Tkhai, Johannes Weiner,
	Michal Hocko, Daniel Jordan, Yang Shi, Mel Gorman, Linux MM,
	LKML

On Sat, Aug 24, 2019 at 9:05 PM Hillf Danton <hdanton@sina.com> wrote:
>
>
> On Sat, 24 Aug 2019 16:15:38 +0800 Yafang Shao wrote:
> >
> > The memcg soft reclaim is called from kswapd reclam path and direct
> > reclaim path,
> > so why not pass the scan_control from the callsite in these two
> > reclaim paths and use it in memcg soft reclaim ?
> > Seems there's no specially reason that we must introduce a new
> > scan_control here.
> >
> To protect memcg from being over reclaimed?

Not only this, but also makes the reclaim path more clear.

> Victim memcg is selected one after another in a fair way, and punished
> by reclaiming one memcg a round no more than nr_to_reclaim ==
> SWAP_CLUSTER_MAX pages. And so is the flip-flop from global to memcg
> reclaiming. We can see similar protection activities in
> commit a394cb8ee632 ("memcg,vmscan: do not break out targeted reclaim
> without reclaimed pages") and
> commit 2bb0f34fe3c1 ("mm: vmscan: do not iterate all mem cgroups for
> global direct reclaim").
>
> No preference seems in either way except for retaining
> nr_to_reclaim == SWAP_CLUSTER_MAX and target_mem_cgroup == memcg.

Setting  target_mem_cgroup here may be a very subtle change for
subsequent processing.
Regarding retraining nr_to_reclaim == SWAP_CLUSTER_MAX, it may not
proper for direct reclaim, that may cause some stall if we iterate all
memcgs here.

> >
> > I have checked the hisotry why this order check is introduced here.
> > The first commit is 4e41695356fb ("memory controller: soft limit
> > reclaim on contention"),
> > but it didn't explained why.
> > At the first glance it is reasonable to remove it, but we should
> > understand why it was introduced at the first place.
>
> Reclaiming order can not make much sense in soft-limit reclaiming
> under the current protection.
>
> Thanks to Adric Blake again.
>
> Hillf
>


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

* Re: WARNINGs in set_task_reclaim_state with memory cgroupandfullmemory usage
  2019-08-27 11:51 ` Yafang Shao
@ 2019-08-27 13:29   ` Hillf Danton
  2019-08-27 13:53     ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Hillf Danton @ 2019-08-27 13:29 UTC (permalink / raw)
  To: Yafang Shao
  Cc: Adric Blake, Andrew Morton, Kirill Tkhai, Johannes Weiner,
	Michal Hocko, Daniel Jordan, Yang Shi, Mel Gorman, Linux MM,
	LKML

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]


>> No preference seems in either way except for retaining
>> nr_to_reclaim == SWAP_CLUSTER_MAX and target_mem_cgroup == memcg.
>
> Setting  target_mem_cgroup here may be a very subtle change for
> subsequent processing.
> Regarding retraining nr_to_reclaim == SWAP_CLUSTER_MAX, it may not
> proper for direct reclaim, that may cause some stall if we iterate all
> memcgs here.

Mind posting a RFC to collect thoughts?


[-- Attachment #2: Type: text/html, Size: 2616 bytes --]

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

* Re: WARNINGs in set_task_reclaim_state with memory cgroupandfullmemory usage
  2019-08-27 13:29   ` WARNINGs in set_task_reclaim_state with memory cgroupandfullmemory usage Hillf Danton
@ 2019-08-27 13:53     ` Michal Hocko
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2019-08-27 13:53 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Yafang Shao, Adric Blake, Andrew Morton, Kirill Tkhai,
	Johannes Weiner, Daniel Jordan, Yang Shi, Mel Gorman, Linux MM,
	LKML

On Tue 27-08-19 21:29:24, Hillf Danton wrote:
> 
> >> No preference seems in either way except for retaining
> >> nr_to_reclaim == SWAP_CLUSTER_MAX and target_mem_cgroup == memcg.
> >
> > Setting  target_mem_cgroup here may be a very subtle change for
> > subsequent processing.
> > Regarding retraining nr_to_reclaim == SWAP_CLUSTER_MAX, it may not
> > proper for direct reclaim, that may cause some stall if we iterate all
> > memcgs here.
> 
> Mind posting a RFC to collect thoughts?

I hope I have explained why this is not desirable
http://lkml.kernel.org/r/20190827120335.GA7538@dhcp22.suse.cz
-- 
Michal Hocko
SUSE Labs


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

end of thread, other threads:[~2019-08-27 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-24 13:05 WARNINGs in set_task_reclaim_state with memory cgroup andfullmemory usage Hillf Danton
2019-08-27 11:51 ` Yafang Shao
2019-08-27 13:29   ` WARNINGs in set_task_reclaim_state with memory cgroupandfullmemory usage Hillf Danton
2019-08-27 13:53     ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).