Skip to contentSkip to conversation

WARNINGs in set_task_reclaim_state with memory cgroup andfullmemory usage

DISCUSSION Hillf Danton 3 participants 4 messages Aug 24, 2019 – Aug 27, 2019 Memory management

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines · 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.

Quoted 7 lines

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

#1 lore raw
Quoted 4 lines · Hillf Danton
Quoted 1 line · On Sat, 24 Aug 2019 16:15:38 +0800 Yafang Shao wrote:
Quoted 8 lines
Quoted 7 lines

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.

Quoted 11 lines

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.

Quoted 15 lines
Quoted 7 lines

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

#2 lore raw

Re: WARNINGs in set_task_reclaim_state with memory cgroupandfullmemory usage

Quoted 9 lines
Quoted 3 lines

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?

#3 lore raw

Re: WARNINGs in set_task_reclaim_state with memory cgroupandfullmemory usage

Quoted 11 lines · Hillf Danton
Quoted 9 lines
Quoted 3 lines

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/[email protected]

Signature · 2 lines
Michal Hocko
SUSE Labs