Re: [PATCH v1] memcg: fix soft lockup in the OOM process

From: Michal Hocko
Date: Tue Dec 17 2024 - 07:54:54 EST


On Tue 17-12-24 12:18:28, Chen Ridong wrote:
[...]
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 1c485beb0b93..14260381cccc 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -390,6 +390,7 @@ static int dump_task(struct task_struct *p, void *arg)
> if (!is_memcg_oom(oc) && !oom_cpuset_eligible(p, oc))
> return 0;
>
> + cond_resched();
> task = find_lock_task_mm(p);
> if (!task) {
> /*

This is called from RCU read lock for the global OOM killer path and I
do not think you can schedule there. I do not remember specifics of task
traversal for crgoup path but I guess that you might need to silence the
soft lockup detector instead or come up with a different iteration
scheme.
--
Michal Hocko
SUSE Labs