Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm writecache: have ssd writeback wait if the kcopyd workqueue is busy

Make dm-writecache wait if the kcopyd workqueue is busy (as will
happen if waiting for page allocation or inside submit_bio).

This change improves performance of "mkfs.ext2" by approximately 20%
on one testbed.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>

authored by

Mikulas Patocka and committed by
Mike Snitzer
293128b1 8c77f1cb

+12
+6
drivers/md/dm-kcopyd.c
··· 980 980 kfree(kc); 981 981 } 982 982 EXPORT_SYMBOL(dm_kcopyd_client_destroy); 983 + 984 + void dm_kcopyd_client_flush(struct dm_kcopyd_client *kc) 985 + { 986 + flush_workqueue(kc->kcopyd_wq); 987 + } 988 + EXPORT_SYMBOL(dm_kcopyd_client_flush);
+5
drivers/md/dm-writecache.c
··· 1812 1812 struct writeback_list wbl; 1813 1813 unsigned long n_walked; 1814 1814 1815 + if (!WC_MODE_PMEM(wc)) { 1816 + /* Wait for any active kcopyd work on behalf of ssd writeback */ 1817 + dm_kcopyd_client_flush(wc->dm_kcopyd); 1818 + } 1819 + 1815 1820 wc_lock(wc); 1816 1821 restart: 1817 1822 if (writecache_has_error(wc)) {
+1
include/linux/dm-kcopyd.h
··· 51 51 struct dm_kcopyd_client; 52 52 struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle); 53 53 void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc); 54 + void dm_kcopyd_client_flush(struct dm_kcopyd_client *kc); 54 55 55 56 /* 56 57 * Submit a copy job to kcopyd. This is built on top of the