All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: dm-devel@redhat.com
Cc: ebiggers@kernel.org, Heinz Mauelshagen <heinzm@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>
Subject: [dm-devel] [PATCH 03/39] dm: use fsleep() instead of msleep() for deterministic sleep duration
Date: Mon, 13 Feb 2023 15:13:25 -0500	[thread overview]
Message-ID: <20230213201401.45973-4-snitzer@kernel.org> (raw)
In-Reply-To: <20230213201401.45973-1-snitzer@kernel.org>

From: Heinz Mauelshagen <heinzm@redhat.com>

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 drivers/md/dm-init.c   | 2 +-
 drivers/md/dm-kcopyd.c | 4 ++--
 drivers/md/dm-snap.c   | 6 +++---
 drivers/md/dm.c        | 8 ++++----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c
index de8d8d0049e0..52362453ab58 100644
--- a/drivers/md/dm-init.c
+++ b/drivers/md/dm-init.c
@@ -295,7 +295,7 @@ static int __init dm_init_init(void)
 		if (waitfor[i]) {
 			DMINFO("waiting for device %s ...", waitfor[i]);
 			while (!dm_get_dev_t(waitfor[i]))
-				msleep(5);
+				fsleep(5000);
 		}
 	}
 
diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
index 837f2a6dd00e..132b50d06121 100644
--- a/drivers/md/dm-kcopyd.c
+++ b/drivers/md/dm-kcopyd.c
@@ -110,7 +110,7 @@ static DEFINE_SPINLOCK(throttle_spinlock);
  * The reason for this is unknown but possibly due to jiffies rounding errors
  * or read/write cache inside the disk.
  */
-#define SLEEP_MSEC			100
+#define SLEEP_USEC			100000
 
 /*
  * Maximum number of sleep events. There is a theoretical livelock if more
@@ -158,7 +158,7 @@ static void io_job_start(struct dm_kcopyd_throttle *t)
 	if (unlikely(skew > 0) && slept < MAX_SLEEPS) {
 		slept++;
 		spin_unlock_irq(&throttle_spinlock);
-		msleep(SLEEP_MSEC);
+		fsleep(SLEEP_USEC);
 		goto try_again;
 	}
 
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 99d5cf1130f0..c50368512bee 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -298,12 +298,12 @@ static int __chunk_is_tracked(struct dm_snapshot *s, chunk_t chunk)
 
 /*
  * This conflicting I/O is extremely improbable in the caller,
- * so msleep(1) is sufficient and there is no need for a wait queue.
+ * so fsleep(1000) is sufficient and there is no need for a wait queue.
  */
 static void __check_for_conflicting_io(struct dm_snapshot *s, chunk_t chunk)
 {
 	while (__chunk_is_tracked(s, chunk))
-		msleep(1);
+		fsleep(1000);
 }
 
 /*
@@ -1494,7 +1494,7 @@ static void snapshot_dtr(struct dm_target *ti)
 	unregister_snapshot(s);
 
 	while (atomic_read(&s->pending_exceptions_count))
-		msleep(1);
+		fsleep(1000);
 	/*
 	 * Ensure instructions in mempool_exit aren't reordered
 	 * before atomic_read.
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index c4a99bdb956c..2e4193ae064c 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -436,7 +436,7 @@ static int dm_prepare_ioctl(struct mapped_device *md, int *srcu_idx,
 	r = ti->type->prepare_ioctl(ti, bdev);
 	if (r == -ENOTCONN && !fatal_signal_pending(current)) {
 		dm_put_live_table(md, *srcu_idx);
-		msleep(10);
+		fsleep(10000);
 		goto retry;
 	}
 
@@ -2442,7 +2442,7 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
 		set_bit(DMF_POST_SUSPENDING, &md->flags);
 		dm_table_postsuspend_targets(map);
 	}
-	/* dm_put_live_table must be before msleep, otherwise deadlock is possible */
+	/* dm_put_live_table must be before fsleep, otherwise deadlock is possible */
 	dm_put_live_table(md, srcu_idx);
 	mutex_unlock(&md->suspend_lock);
 
@@ -2454,7 +2454,7 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
 	 */
 	if (wait)
 		while (atomic_read(&md->holders))
-			msleep(1);
+			fsleep(1000);
 	else if (atomic_read(&md->holders))
 		DMWARN("%s: Forcibly removing mapped_device still in use! (%d users)",
 		       dm_device_name(md), atomic_read(&md->holders));
@@ -2531,7 +2531,7 @@ static int dm_wait_for_completion(struct mapped_device *md, unsigned int task_st
 			break;
 		}
 
-		msleep(5);
+		fsleep(5000);
 	}
 
 	return r;
-- 
2.37.0 (Apple Git-136)

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2023-02-13 20:14 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 20:13 [dm-devel] [PATCH 00/39] dm: fix checkpatch errors and warnings Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 01/39] dm: add missing SPDX-License-Indentifiers Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 02/39] dm: prefer kmap_local_page() instead of deprecated kmap_atomic() Mike Snitzer
2023-02-13 20:13 ` Mike Snitzer [this message]
2023-02-13 20:13 ` [dm-devel] [PATCH 04/39] dm: change "unsigned" to "unsigned int" Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 05/39] dm: avoid assignment in if conditions Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 06/39] dm: enclose complex macros into parentheses where possible Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 07/39] dm: avoid initializing static variables Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 08/39] dm: address space issues relative to switch/while/for/ Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 09/39] dm: address indent/space issues Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 10/39] dm: correct block comments format Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 11/39] dm: fix undue/missing spaces Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 12/39] dm: fix trailing statements Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 13/39] dm crypt: correct 'foo*' to 'foo *' Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 14/39] dm block-manager: avoid not required parentheses Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 15/39] dm: avoid spaces before function arguments or in favour of tabs Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 16/39] dm: add argument identifier names Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 17/39] dm: add missing empty lines Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 18/39] dm: remove unnecessary braces from single statement blocks Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 19/39] dm: avoid split of quoted strings where possible Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 20/39] dm: adjust EXPORT_SYMBOL() to follow functions immediately Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 21/39] dm: prefer '"%s...", __func__' Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 22/39] dm: avoid using symbolic permissions Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 23/39] dm: favour __aligned(N) versus "__attribute__ (aligned(N))" Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 24/39] dm: favour __packed versus "__attribute__ ((packed))" Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 25/39] dm: avoid useless 'else' after 'break' or return' Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 26/39] dm: add missing blank line after declarations/fix those Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 27/39] dm: avoid inline filenames Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 28/39] dm: don't indent labels Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 29/39] dm ioctl: have constant on the right side of the test Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 30/39] dm log: avoid trailing semicolon in macro Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 31/39] dm log: avoid multiple line dereference Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 32/39] dm: avoid 'do {} while(0)' loop in single statement macros Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 33/39] dm: fix use of sizeof() macro Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 34/39] dm integrity: change macros min/max() -> min_t/max_t where appropriate Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 35/39] dm: avoid void function return statements Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 36/39] dm ioctl: prefer strscpy() instead of strlcpy() Mike Snitzer
2023-02-13 20:13 ` [dm-devel] [PATCH 37/39] dm: fix suspect indent whitespace Mike Snitzer
2023-02-13 20:14 ` [dm-devel] [PATCH 38/39] dm: declare variables static when sensible Mike Snitzer
2023-02-13 20:14 ` [dm-devel] [PATCH 39/39] dm clone: prefer kvmalloc_array() Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230213201401.45973-4-snitzer@kernel.org \
    --to=snitzer@kernel.org \
    --cc=dm-devel@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=heinzm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.