netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: core: fix msleep() is not accurate
@ 2020-12-10  9:35 Yejune Deng
  2020-12-10 10:19 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Yejune Deng @ 2020-12-10  9:35 UTC (permalink / raw)
  To: davem, kuba, ast, andriin, daniel, edumazet, ap420073,
	bjorn.topel, xiyou.wangcong, jiri
  Cc: netdev, linux-kernel, yejune.deng

See Documentation/timers/timers-howto.rst, msleep() is not
for (1ms - 20ms), There is a more advanced API is used.

Signed-off-by: Yejune Deng <yejune.deng@gmail.com>
---
 net/core/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index d33099f..6e83ee03 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6726,9 +6726,9 @@ void napi_disable(struct napi_struct *n)
 	set_bit(NAPI_STATE_DISABLE, &n->state);
 
 	while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
-		msleep(1);
+		fsleep(1000);
 	while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
-		msleep(1);
+		fsleep(1000);
 
 	hrtimer_cancel(&n->timer);
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH] net: core: fix msleep() is not accurate
@ 2020-12-15  2:04 Yejune Deng
  2020-12-16 19:33 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Yejune Deng @ 2020-12-15  2:04 UTC (permalink / raw)
  To: davem, kuba, ast, andriin, jiri, edumazet, ap420073, bjorn.topel
  Cc: netdev, linux-kernel, yejune.deng

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>
---
 net/core/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index d33099f..c0aa52f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6726,9 +6726,9 @@ void napi_disable(struct napi_struct *n)
 	set_bit(NAPI_STATE_DISABLE, &n->state);
 
 	while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
-		msleep(1);
+		usleep_range(10, 200);
 	while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
-		msleep(1);
+		usleep_range(10, 200);
 
 	hrtimer_cancel(&n->timer);
 
-- 
1.9.1


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

end of thread, other threads:[~2020-12-16 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-10  9:35 [PATCH] net: core: fix msleep() is not accurate Yejune Deng
2020-12-10 10:19 ` Eric Dumazet
2020-12-11  2:43   ` Yejune Deng
  -- strict thread matches above, loose matches on Subject: below --
2020-12-15  2:04 Yejune Deng
2020-12-16 19:33 ` Jakub Kicinski

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