Skip to content

Commit 293128b

Browse files
Mikulas Patockasnitm
authored andcommitted
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 <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 8c77f1c commit 293128b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

drivers/md/dm-kcopyd.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,3 +980,9 @@ void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc)
980980
kfree(kc);
981981
}
982982
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);

drivers/md/dm-writecache.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,6 +1812,11 @@ static void writecache_writeback(struct work_struct *work)
18121812
struct writeback_list wbl;
18131813
unsigned long n_walked;
18141814

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+
18151820
wc_lock(wc);
18161821
restart:
18171822
if (writecache_has_error(wc)) {

include/linux/dm-kcopyd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ MODULE_PARM_DESC(name, description)
5151
struct dm_kcopyd_client;
5252
struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *throttle);
5353
void dm_kcopyd_client_destroy(struct dm_kcopyd_client *kc);
54+
void dm_kcopyd_client_flush(struct dm_kcopyd_client *kc);
5455

5556
/*
5657
* Submit a copy job to kcopyd. This is built on top of the

0 commit comments

Comments
 (0)