summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBreno Leitao <leitao@debian.org>2026-07-20 06:23:45 -0700
committerAndrew Morton <akpm@linux-foundation.org>2026-08-24 18:42:54 -0700
commit3541a2b06ecd78ba333188df04368dcf97273d6a (patch)
treecd10dc497dec6c85cb22f9cb6351ac81c720953e /include
parentfb580e196497738d98dbad5b8459913435b376e7 (diff)
downloadlinux-3541a2b06ecd78ba333188df04368dcf97273d6a.tar.gz
linux-3541a2b06ecd78ba333188df04368dcf97273d6a.zip
mm/kmemleak: report RCU-tasks quiescent states during the scan
kmemleak_scan() can run for ages on large debug kernels. It was causing some soft-lockups which I got fixed with commit 3175fcfec8b16baeb ("mm/kmemleak: avoid soft lockup when scanning task stacks") with our beloved cond_resched(). I've got the fix above deployed in the Meta fleet, and now I am seeing: INFO: rcu_tasks detected stalls on tasks: task:kmemleak state:R ... nvcsw: 274/274 holdout: 1 idle_cpu: -1/3 scan_block scan_gray_list kmemleak_scan and, worse, blocks the callers waiting on that grace period. Here a BPF struct_ops map free, which waits via synchronize_rcu_mult(call_rcu, call_rcu_tasks), is stuck long enough to also trip the hung task check: INFO: task kworker/...:bpf_map_free_deferred blocked for 122 seconds __wait_rcu_gp bpf_struct_ops_map_free Then I've learned that cond_resched() is not an RCU-tasks quiescent state, so, we need to use stronger primitives. Use cond_resched_tasks_rcu_qs() at the scan reschedule points so the scan reports an RCU-tasks quiescent state as it proceeds. Inspired by commit b96285e10aad ("tracing: Have osnoise_main() add a quiescent state for task rcu"). Link: https://lore.kernel.org/20260720-kmemleak_rcu_task-v1-1-5b460ade777d@debian.org Fixes: c4b28963fd79 ("mm/kmemleak: rely on rcu for task stack scanning") Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Reviewed-by: SJ Park <sj@kernel.org> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Breno Leitao <leitao@debian.org> Cc: Puranjay Mohan <puranjay@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions