Unverified Commit 0094f7d8 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14648 memcg: fix soft lockup in the OOM process

parents aae2f80e d05e98f5
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1322,6 +1322,7 @@ void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
{
	struct mem_cgroup *iter;
	int ret = 0;
	int i = 0;

	BUG_ON(mem_cgroup_is_root(memcg));

@@ -1330,8 +1331,12 @@ void mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
		struct task_struct *task;

		css_task_iter_start(&iter->css, CSS_TASK_ITER_PROCS, &it);
		while (!ret && (task = css_task_iter_next(&it)))
		while (!ret && (task = css_task_iter_next(&it))) {
			/* Avoid potential softlockup warning */
			if ((++i & 1023) == 0)
				cond_resched();
			ret = fn(task, arg);
		}
		css_task_iter_end(&it);
		if (ret) {
			mem_cgroup_iter_break(memcg, iter);
+7 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include <linux/kthread.h>
#include <linux/init.h>
#include <linux/mmu_notifier.h>
#include <linux/nmi.h>

#include <asm/tlb.h>
#include "internal.h"
@@ -482,10 +483,15 @@ static void dump_tasks(struct oom_control *oc)
		memcg_print_bad_task(oc);
	} else {
		struct task_struct *p;
		int i = 0;

		rcu_read_lock();
		for_each_process(p)
		for_each_process(p) {
			/* Avoid potential softlockup warning */
			if ((++i & 1023) == 0)
				touch_softlockup_watchdog();
			dump_task(p, oc);
		}
		rcu_read_unlock();
	}
}