summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2017-07-28 10:42:24 -0400
committerMike Snitzer <snitzer@redhat.com>2017-09-11 09:50:46 -0400
commit0c79c62021d23f0b5c942cf59d43a7ce6c24cd1b (patch)
tree8b8459eecabd432bdf38dce5dd3dc875211ca7ec
parentcf0dec6674c1e2a7ba326cfbbe7f05a70458afc9 (diff)
downloadlinux-stable-0c79c62021d23f0b5c942cf59d43a7ce6c24cd1b.tar.gz
linux-stable-0c79c62021d23f0b5c942cf59d43a7ce6c24cd1b.tar.bz2
linux-stable-0c79c62021d23f0b5c942cf59d43a7ce6c24cd1b.zip
dm log writes: don't use all the cpu while waiting to log blocks
The check to see if the logging kthread needs to go to sleep is wrong, it checks lc->pending_blocks, which will be non-0 if there are any blocks that are pending, whether they are ready to be logged or not. What we really want is to go to sleep until it's time to log blocks, so change this check so we do actually go to sleep in between flushes. Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--drivers/md/dm-log-writes.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c
index a1da0eb58a93..9aab510a1709 100644
--- a/drivers/md/dm-log-writes.c
+++ b/drivers/md/dm-log-writes.c
@@ -399,7 +399,7 @@ next:
if (!try_to_freeze()) {
set_current_state(TASK_INTERRUPTIBLE);
if (!kthread_should_stop() &&
- !atomic_read(&lc->pending_blocks))
+ list_empty(&lc->logging_blocks))
schedule();
__set_current_state(TASK_RUNNING);
}