/* Limit number of writeback bios in flight */
        struct semaphore        in_flight;
        struct task_struct      *writeback_thread;
+       struct workqueue_struct *writeback_write_wq;
 
        struct keybuf           writeback_keys;
 
 
        cancel_delayed_work_sync(&dc->writeback_rate_update);
        if (!IS_ERR_OR_NULL(dc->writeback_thread))
                kthread_stop(dc->writeback_thread);
+       if (dc->writeback_write_wq)
+               destroy_workqueue(dc->writeback_write_wq);
 
        mutex_lock(&bch_register_lock);
 
 
 
        closure_bio_submit(&io->bio, cl);
 
-       continue_at(cl, write_dirty_finish, system_wq);
+       continue_at(cl, write_dirty_finish, io->dc->writeback_write_wq);
 }
 
 static void read_dirty_endio(struct bio *bio)
 
        closure_bio_submit(&io->bio, cl);
 
-       continue_at(cl, write_dirty, system_wq);
+       continue_at(cl, write_dirty, io->dc->writeback_write_wq);
 }
 
 static void read_dirty(struct cached_dev *dc)
 
 int bch_cached_dev_writeback_start(struct cached_dev *dc)
 {
+       dc->writeback_write_wq = alloc_workqueue("bcache_writeback_wq",
+                                               WQ_MEM_RECLAIM, 0);
+       if (!dc->writeback_write_wq)
+               return -ENOMEM;
+
        dc->writeback_thread = kthread_create(bch_writeback_thread, dc,
                                              "bcache_writeback");
        if (IS_ERR(dc->writeback_thread))