All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] Patch "dm mpath: only use ktime_get_ns() in historical selector" has been added to the 5.15-stable tree
@ 2022-04-18  4:04 Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2022-04-18  4:04 UTC (permalink / raw)
  To: stable-commits, khazhy; +Cc: dm-devel, Mike Snitzer, Alasdair Kergon

This is a note to let you know that I've just added the patch titled

    dm mpath: only use ktime_get_ns() in historical selector

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dm-mpath-only-use-ktime_get_ns-in-historical-selecto.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.



commit d944a5392b422a0721a00dfd87de491045451b79
Author: Khazhismel Kumykov <khazhy@google.com>
Date:   Mon Apr 11 15:03:35 2022 -0700

    dm mpath: only use ktime_get_ns() in historical selector
    
    [ Upstream commit ce40426fdc3c92acdba6b5ca74bc7277ffaa6a3d ]
    
    Mixing sched_clock() and ktime_get_ns() usage will give bad results.
    
    Switch hst_select_path() from using sched_clock() to ktime_get_ns().
    Also rename path_service_time()'s 'sched_now' variable to 'now'.
    
    Fixes: 2613eab11996 ("dm mpath: add Historical Service Time Path Selector")
    Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

diff --git a/drivers/md/dm-ps-historical-service-time.c b/drivers/md/dm-ps-historical-service-time.c
index 1856a1b125cc..82f2a06153dc 100644
--- a/drivers/md/dm-ps-historical-service-time.c
+++ b/drivers/md/dm-ps-historical-service-time.c
@@ -432,7 +432,7 @@ static struct dm_path *hst_select_path(struct path_selector *ps,
 {
 	struct selector *s = ps->context;
 	struct path_info *pi = NULL, *best = NULL;
-	u64 time_now = sched_clock();
+	u64 time_now = ktime_get_ns();
 	struct dm_path *ret = NULL;
 	unsigned long flags;
 
@@ -473,7 +473,7 @@ static int hst_start_io(struct path_selector *ps, struct dm_path *path,
 
 static u64 path_service_time(struct path_info *pi, u64 start_time)
 {
-	u64 sched_now = ktime_get_ns();
+	u64 now = ktime_get_ns();
 
 	/* if a previous disk request has finished after this IO was
 	 * sent to the hardware, pretend the submission happened
@@ -482,11 +482,11 @@ static u64 path_service_time(struct path_info *pi, u64 start_time)
 	if (time_after64(pi->last_finish, start_time))
 		start_time = pi->last_finish;
 
-	pi->last_finish = sched_now;
-	if (time_before64(sched_now, start_time))
+	pi->last_finish = now;
+	if (time_before64(now, start_time))
 		return 0;
 
-	return sched_now - start_time;
+	return now - start_time;
 }
 
 static int hst_end_io(struct path_selector *ps, struct dm_path *path,

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-18  4:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-18  4:04 [dm-devel] Patch "dm mpath: only use ktime_get_ns() in historical selector" has been added to the 5.15-stable tree Sasha Levin

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.