* [dm-devel] [PATCH] dm-writecache: back off if the kcopyd workqueue is blocked
@ 2021-06-15 17:47 Mikulas Patocka
0 siblings, 0 replies; 2+ messages in thread
From: Mikulas Patocka @ 2021-06-15 17:47 UTC (permalink / raw)
To: Mike Snitzer; +Cc: Heinz Mauelshagen, dm-devel, Joe Thornber
This patch makes dm-writecache wait if the kcopyd workqueue is blocked (it
happens when one of the devices is contested). It improves performance of
"mkfs.ext2" by approximatelly 20%.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Index: linux/drivers/md/dm-kcopyd.c
===================================================================
--- linux.orig/drivers/md/dm-kcopyd.c
+++ linux/drivers/md/dm-kcopyd.c
@@ -888,6 +888,12 @@ void dm_kcopyd_do_callback(void *j, int
}
EXPORT_SYMBOL(dm_kcopyd_do_callback);
+void dm_kcopyd_wait_if_busy(struct dm_kcopyd_client *kc)
+{
+ flush_workqueue(kc->kcopyd_wq);
+}
+EXPORT_SYMBOL(dm_kcopyd_wait_if_busy);
+
/*
* Cancels a kcopyd job, eg. someone might be deactivating a
* mirror.
Index: linux/drivers/md/dm-writecache.c
===================================================================
--- linux.orig/drivers/md/dm-writecache.c
+++ linux/drivers/md/dm-writecache.c
@@ -1819,6 +1819,9 @@ static void writecache_writeback(struct
struct writeback_list wbl;
unsigned long n_walked;
+ if (!WC_MODE_PMEM(wc))
+ dm_kcopyd_wait_if_busy(wc->dm_kcopyd);
+
wc_lock(wc);
restart:
if (writecache_has_error(wc)) {
Index: linux/include/linux/dm-kcopyd.h
===================================================================
--- linux.orig/include/linux/dm-kcopyd.h
+++ linux/include/linux/dm-kcopyd.h
@@ -81,6 +81,8 @@ void *dm_kcopyd_prepare_callback(struct
dm_kcopyd_notify_fn fn, void *context);
void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
+void dm_kcopyd_wait_if_busy(struct dm_kcopyd_client *kc);
+
void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
unsigned num_dests, struct dm_io_region *dests,
unsigned flags, dm_kcopyd_notify_fn fn, void *context);
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [dm-devel] [PATCH] dm-writecache: back off if the kcopyd workqueue is blocked
@ 2021-06-06 20:08 Mikulas Patocka
0 siblings, 0 replies; 2+ messages in thread
From: Mikulas Patocka @ 2021-06-06 20:08 UTC (permalink / raw)
To: Mike Snitzer, Joe Thornber; +Cc: dm-devel
Hi
Does this patch help in your tests? In my tests, it improves performance
by about 20%.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Index: linux-2.6/drivers/md/dm-kcopyd.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-kcopyd.c
+++ linux-2.6/drivers/md/dm-kcopyd.c
@@ -896,6 +896,12 @@ void dm_kcopyd_do_callback(void *j, int
}
EXPORT_SYMBOL(dm_kcopyd_do_callback);
+void dm_kcopyd_wait_if_busy(struct dm_kcopyd_client *kc)
+{
+ flush_workqueue(kc->kcopyd_wq);
+}
+EXPORT_SYMBOL(dm_kcopyd_wait_if_busy);
+
/*
* Cancels a kcopyd job, eg. someone might be deactivating a
* mirror.
Index: linux-2.6/drivers/md/dm-writecache.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-writecache.c
+++ linux-2.6/drivers/md/dm-writecache.c
@@ -1815,6 +1815,9 @@ static void writecache_writeback(struct
struct writeback_list wbl;
unsigned long n_walked;
+ if (!WC_MODE_PMEM(wc))
+ dm_kcopyd_wait_if_busy(wc->dm_kcopyd);
+
wc_lock(wc);
restart:
if (writecache_has_error(wc)) {
Index: linux-2.6/include/linux/dm-kcopyd.h
===================================================================
--- linux-2.6.orig/include/linux/dm-kcopyd.h
+++ linux-2.6/include/linux/dm-kcopyd.h
@@ -82,6 +82,8 @@ void *dm_kcopyd_prepare_callback(struct
dm_kcopyd_notify_fn fn, void *context);
void dm_kcopyd_do_callback(void *job, int read_err, unsigned long write_err);
+void dm_kcopyd_wait_if_busy(struct dm_kcopyd_client *kc);
+
void dm_kcopyd_zero(struct dm_kcopyd_client *kc,
unsigned num_dests, struct dm_io_region *dests,
unsigned flags, dm_kcopyd_notify_fn fn, void *context);
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-15 17:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 17:47 [dm-devel] [PATCH] dm-writecache: back off if the kcopyd workqueue is blocked Mikulas Patocka
-- strict thread matches above, loose matches on Subject: below --
2021-06-06 20:08 Mikulas Patocka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).