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

!14647 memcg: fix soft lockup in the OOM process

parents 25b0111b b2bb8ee5
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1230,6 +1230,7 @@ int mem_cgroup_scan_tasks(struct mem_cgroup *memcg,
{
	struct mem_cgroup *iter;
	int ret = 0;
	int i = 0;

	BUG_ON(memcg == root_mem_cgroup);

@@ -1238,8 +1239,12 @@ int 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
@@ -42,6 +42,7 @@
#include <linux/init.h>
#include <linux/mmu_notifier.h>
#include <linux/share_pool.h>
#include <linux/nmi.h>

#include <asm/tlb.h>
#include "internal.h"
@@ -518,10 +519,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();
	}
}