linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] init:  fix msleep() is not accurate
@ 2020-12-11  3:24 Yejune Deng
  2020-12-11  7:28 ` Dominik Brodowski
  0 siblings, 1 reply; 2+ messages in thread
From: Yejune Deng @ 2020-12-11  3:24 UTC (permalink / raw)
  To: axboe, hare, jack, gregkh, tj, linux; +Cc: yejune.deng, linux-kernel

See Documentation/timers/timers-howto.rst, msleep() is not
for (1ms - 20ms),use usleep_range() instead.

Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
 init/do_mounts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index a78e44e..e007b47 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -606,7 +606,7 @@ void __init prepare_namespace(void)
 			saved_root_name);
 		while (driver_probe_done() != 0 ||
 			(ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
-			msleep(5);
+			usleep_range(5000, 6000);
 		async_synchronize_full();
 	}
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] init:  fix msleep() is not accurate
  2020-12-11  3:24 [PATCH] init: fix msleep() is not accurate Yejune Deng
@ 2020-12-11  7:28 ` Dominik Brodowski
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2020-12-11  7:28 UTC (permalink / raw)
  To: Yejune Deng; +Cc: axboe, hare, jack, gregkh, tj, linux-kernel

Am Fri, Dec 11, 2020 at 11:24:12AM +0800 schrieb Yejune Deng:
> See Documentation/timers/timers-howto.rst, msleep() is not
> for (1ms - 20ms),use usleep_range() instead.

While technically correct, this branch is only taken if the "rootwait"
kernel parameter is passed -- and as the kernel is looping here, it does not
really hurt if the msleep(5) takes a bit longer than advertised.

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-11  7:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11  3:24 [PATCH] init: fix msleep() is not accurate Yejune Deng
2020-12-11  7:28 ` Dominik Brodowski

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).