]> Git Repo - linux.git/commit
kmemleak: add scheduling point to kmemleak_scan()
authorYisheng Xie <[email protected]>
Thu, 30 Nov 2017 00:11:08 +0000 (16:11 -0800)
committerLinus Torvalds <[email protected]>
Thu, 30 Nov 2017 02:40:43 +0000 (18:40 -0800)
commitbde5f6bc68db51128f875a756e9082a6c6ff7b4c
tree76d26ad04100d9b378fc2ad520b299c69fef528f
parentedbddb83a15b4361d8c3bf00aabee85fd3ef4d80
kmemleak: add scheduling point to kmemleak_scan()

kmemleak_scan() will scan struct page for each node and it can be really
large and resulting in a soft lockup.  We have seen a soft lockup when
do scan while compile kernel:

  watchdog: BUG: soft lockup - CPU#53 stuck for 22s! [bash:10287]
 [...]
  Call Trace:
   kmemleak_scan+0x21a/0x4c0
   kmemleak_write+0x312/0x350
   full_proxy_write+0x5a/0xa0
   __vfs_write+0x33/0x150
   vfs_write+0xad/0x1a0
   SyS_write+0x52/0xc0
   do_syscall_64+0x61/0x1a0
   entry_SYSCALL64_slow_path+0x25/0x25

Fix this by adding cond_resched every MAX_SCAN_SIZE.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yisheng Xie <[email protected]>
Suggested-by: Catalin Marinas <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Cc: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/kmemleak.c
This page took 0.055568 seconds and 4 git commands to generate.