netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eliezer Tamir <eliezer.tamir@linux.intel.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Woodhouse <dwmw2@infradead.org>,
	Eliezer Tamir <eliezer@tamir.org.il>
Subject: Re: [PATCH net-next] net: rename low latency sockets functions to busy poll
Date: Mon, 08 Jul 2013 22:46:04 +0300	[thread overview]
Message-ID: <51DB16FC.7060003@linux.intel.com> (raw)
In-Reply-To: <CA+55aFwWAmHhYaPWVm7rsqiD9+RhDPpgVC1yWc0oNmP38bty4Q@mail.gmail.com>

On 08/07/2013 22:37, Linus Torvalds wrote:
> On Mon, Jul 8, 2013 at 10:14 AM, Eliezer Tamir
> <eliezer.tamir@linux.intel.com> wrote:
>>
>> I think there is no way for the compiler to know the value of
>> can_busy_loop at compile time. It depends on the replies we get
>> from polling the sockets. ll_flag was there to make sure the compiler
>> will know when things are defined out.
> 
> No, my point was that we want to handle the easily seen register test
> first, and not even have to load current().
> 
> The compiler may end up scheduling the code to load current anyway,
> but the way you wrote it it's pretty much guaranteed that it will do
> it.

I see. OK.

> In fact, I'd argue for initializing start_time to zero, and have the
> "have we timed out" logic load it only if necessary, rather than
> initializing it based on whether POLL_BUSY_WAIT was set or not.
> Because one common case - even with POLL_BUSY_WAIT - is that we go
> through the loop exactly once, and the data exists on the very first
> try. And that is in fact the case we want to optimize and not do any
> extra work for at all.
> 
> So I would actually argue that the whole timeout code might as well be
> something like
> 
>     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;
>     }
> 

OK.

Thanks,
Eliezer

  reply	other threads:[~2013-07-08 19:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 13:20 [PATCH net-next] net: rename low latency sockets functions to busy poll Eliezer Tamir
2013-07-08 16:37 ` Linus Torvalds
2013-07-08 17:14   ` Eliezer Tamir
2013-07-08 19:37     ` Linus Torvalds
2013-07-08 19:46       ` Eliezer Tamir [this message]
2013-07-08 19:59         ` Stephen Hemminger
2013-07-08 20:05         ` Stephen Hemminger
2013-07-08 20:10           ` Linus Torvalds
2013-07-09  2:27       ` David Miller
2013-07-09 22:25 ` Jonathan Corbet
2013-07-09 23:06   ` David Miller
2013-07-10  3:29     ` Eliezer Tamir
2013-07-10  4:41       ` David Miller
2013-07-10  5:21         ` Eliezer Tamir
2013-07-10  6:10           ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51DB16FC.7060003@linux.intel.com \
    --to=eliezer.tamir@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=eliezer@tamir.org.il \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).