diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2017-12-14 18:32:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-12-14 19:00:48 -0500 |
commit | 13ab183d138f607d885e995d625e58d47678bf97 (patch) | |
tree | 22639ff865259e61a78a8685ea2056930bbc5b48 | |
parent | 338f1d9d1b829fec494d053f62820a2ee625b1ec (diff) |
mm/kmemleak.c: make cond_resched() rate-limiting more efficient
Commit bde5f6bc68db ("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: bde5f6bc68db5 ("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>
-rw-r--r-- | mm/kmemleak.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 3d4781756d50..d73c14294f3a 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -1523,7 +1523,7 @@ static void kmemleak_scan(void) | |||
1523 | if (page_count(page) == 0) | 1523 | if (page_count(page) == 0) |
1524 | continue; | 1524 | continue; |
1525 | scan_block(page, page + 1, NULL); | 1525 | scan_block(page, page + 1, NULL); |
1526 | if (!(pfn % (MAX_SCAN_SIZE / sizeof(*page)))) | 1526 | if (!(pfn & 63)) |
1527 | cond_resched(); | 1527 | cond_resched(); |
1528 | } | 1528 | } |
1529 | } | 1529 | } |