mm/kmemleak.c: make cond_resched() rate-limiting more efficient
Commitbde5f6bc68
("kmemleak: add scheduling point to kmemleak_scan()") tries to rate-limit the frequency of cond_resched() calls, but does it in a way which might incur an expensive division operation in the inner loop. Simplify this. Fixes:bde5f6bc68
("kmemleak: add scheduling point to kmemleak_scan()") Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Yisheng Xie <xieyisheng1@huawei.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Michal Hocko <mhocko@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
338f1d9d1b
commit
13ab183d13
1 changed files with 1 additions and 1 deletions
|
@ -1523,7 +1523,7 @@ static void kmemleak_scan(void)
|
|||
if (page_count(page) == 0)
|
||||
continue;
|
||||
scan_block(page, page + 1, NULL);
|
||||
if (!(pfn % (MAX_SCAN_SIZE / sizeof(*page))))
|
||||
if (!(pfn & 63))
|
||||
cond_resched();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue