Thread (40 messages) 40 messages, 9 authors, 2014-02-28

Re: [PATCH v2 net-next] tcp: switch rtt estimations to usec resolution

From: Eric Dumazet <hidden>
Date: 2014-02-28 13:51:16

On Fri, 2014-02-28 at 14:31 +0100, Andi Kleen wrote:
quoted
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();
        }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help