bcachefs: Add a cond_resched call to the copygc main loop
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 25 May 2021 22:42:05 +0000 (18:42 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:04 +0000 (17:09 -0400)
We seem to have a bug where the copygc thread ends up spinning and
making the system unusable - this will at least prevent it from locking
up the machine, and it's a good thing to have anyways.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/movinggc.c

index acb4d943db79e2e0d95b179c4884c1d279a75f01..e8f9d70af93021e5e54e5c594a1a25cd62effa32 100644 (file)
@@ -317,6 +317,8 @@ static int bch2_copygc_thread(void *arg)
        set_freezable();
 
        while (!kthread_should_stop()) {
+               cond_resched();
+
                if (kthread_wait_freezable(c->copy_gc_enabled))
                        break;