Message ID | 20200921180610.62242-1-jpitti@cisco.com |
---|---|
State | New |
Headers | show |
Series | [v4.19] mm: memcg: fix memcg reclaim soft lockup | expand |
diff --git a/mm/vmscan.c b/mm/vmscan.c index bc2ecd43251a..b93dc8fc6007 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2708,6 +2708,14 @@ static bool shrink_node(pg_data_t *pgdat, struct scan_control *sc) unsigned long reclaimed; unsigned long scanned; + /* + * This loop can become CPU-bound when target memcgs + * aren't eligible for reclaim - either because they + * don't have any reclaimable pages, or because their + * memory is explicitly protected. Avoid soft lockups. + */ + cond_resched(); + switch (mem_cgroup_protected(root, memcg)) { case MEMCG_PROT_MIN: /*