From c4d4b2f01abd95af7c6dccf236e2760aef5a9b69 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 25 May 2021 18:42:05 -0400 Subject: [PATCH] bcachefs: Add a cond_resched call to the copygc main loop 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 --- fs/bcachefs/movinggc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c index acb4d943db79e..e8f9d70af9302 100644 --- a/fs/bcachefs/movinggc.c +++ b/fs/bcachefs/movinggc.c @@ -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; -- 2.30.2