[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1393595472.26794.59.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Fri, 28 Feb 2014 05:51:12 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: Julian Anastasov <ja@....bg>, David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Yuchung Cheng <ycheng@...gle.com>,
Neal Cardwell <ncardwell@...gle.com>,
Larry Brakmo <brakmo@...gle.com>
Subject: Re: [PATCH v2 net-next] tcp: switch rtt estimations to usec
resolution
On Fri, 2014-02-28 at 14:31 +0100, Andi Kleen wrote:
> > Right, so I cooked this instead :
> >
> > http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=363ec392352e55c61ce2799c3f15f89f9429bba7
> >
> > Is this OK or do you see a problem with this ?
>
> It seems mostly ok. I assume the compiler optimizes the constant do_div to a
> multiplication?
>
Yep, its a reciprocal.
> I'm not sure it's better than ktime() if it works. So it may be still
> better to have some global flag that says "ktime is slow" and
> qualify it on that. But that would need changing the timer
> subsystem.
It seems to use ktime_get() on x86 if tsc runs at constant rate.
There is already a static key switch.
int sched_clock_stable(void)
{
return static_key_false(&__sched_clock_stable);
}
...
if (sched_clock_stable())
return sched_clock();
And set_sched_clock_stable() is called from early_init_intel()
/*
* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate
* with P/T states and does not stop in deep C-states.
*
* It is also reliable across cores and sockets. (but not across
* cabinets - we turn it off in that case explicitly.)
*/
if (c->x86_power & (1 << 8)) {
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
if (!check_tsc_unstable())
set_sched_clock_stable();
}
--
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