lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 8 Jul 2013 13:10:48 -0700
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Stephen Hemminger <stephen@...workplumber.org>
Cc:	Eliezer Tamir <eliezer.tamir@...ux.intel.com>,
	David Miller <davem@...emloft.net>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Network Development <netdev@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Woodhouse <dwmw2@...radead.org>,
	Eliezer Tamir <eliezer@...ir.org.il>
Subject: Re: [PATCH net-next] net: rename low latency sockets functions to
 busy poll

On Mon, Jul 8, 2013 at 1:05 PM, Stephen Hemminger
<stephen@...workplumber.org> wrote:
>> >
>> >     unsigned long start_time = 0;
>> >     ...
>> >     if (want_busy_poll && !need_resched()) {
>> >         unsigned long now = busy_poll_sched_clock();
>> >         if (!start_time) {
>> >             start_time = now + sysctl.busypoll;
>> >             continue;
>> >         }
>> >         if (time_before(start_time, now))
>> >             continue;
>> >     }
>> >
>>
>
> Since this code is in hot path, and a special case, looks like a good
> candidate for static branch.

No, it's not static. It's an initializer, yes, but it's not a static
one, and it gets run on every single select()/poll(). Well, every
single one that goes through the loop more than once.

So it's very much a dynamic condition. It's just placed that way to
avoid doing the (relatively expensive) time read for the case where
data is available immediately.

And the "data is available immediately" case is actually fairly
common. Sometimes it's because the producer/network is faster than the
consumer. And sometimes it's because you get big chunks at a time, but
the reader/writer ends up always going through a select() loop without
actually reading/writing everything in a loop until it gets a
full/empty error.

And I bet that both of those cases happen even with programs/networks
that end up using the magic low-latency/busyloop polling flags. So
avoiding the timer read if at all possible is definitely a good idea.

                  Linus
--
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