[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1318949264.2657.97.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
Date: Tue, 18 Oct 2011 16:47:44 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Ben Hutchings <bhutchings@...arflare.com>
Cc: Daniel Turull <daniel.turull@...il.com>,
David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
Robert Olsson <robert@...julf.net>,
Voravit Tanyingyong <voravit@....se>,
Jens Laas <jens.laas@...m.uu.se>
Subject: Re: [patch] pktgen: bug when calling ndelay in x86 architectures
Le mardi 18 octobre 2011 à 15:00 +0100, Ben Hutchings a écrit :
> AIUI, the reason for limits on delays is not that it's bad practice to
> spin for so long, but that the delay calculations may overflow or
> otherwise become inaccurate.
OK, I can understand that, then a more appropriate patch would be :
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 796044a..28bbf5b 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2145,9 +2145,12 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until)
}
start_time = ktime_now();
- if (remaining < 100000)
- ndelay(remaining); /* really small just spin */
- else {
+ if (remaining < 100000) {
+ if (remaining >= 10000)
+ udelay(remaining/1000);
+ else
+ ndelay(remaining);
+ } else {
/* see do_nanosleep */
hrtimer_init_sleeper(&t, current);
do {
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists