Patches contributed by Eötvös Lorand University


commit 4a1dba72384193753e44e15d9d05a50be6587271
Merge: ed13ec58bfe0 97f7f8189fe5
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Nov 15 11:03:30 2011 +0100

    Merge branch 'urgent' of git://amd64.org/linux/rric into perf/urgent

commit efc96737bd82b508794d2b28061a12af4a3f7766
Merge: 1ec454baf124 7e9a49ef5426
Author: Ingo Molnar <mingo@elte.hu>
Date:   Fri Nov 11 08:19:37 2011 +0100

    Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core

commit 367177e50189ab0a983b52f3d3f7eb2a1927db71
Merge: c2bc11113c50 d65670a78cdb
Author: Ingo Molnar <mingo@elte.hu>
Date:   Fri Nov 11 08:10:42 2011 +0100

    Merge branch 'formingo/3.2/tip/timers/core' of git://git.linaro.org/people/jstultz/linux into timers/core
    
    Conflicts:
            kernel/time/timekeeping.c

diff --cc kernel/time/timekeeping.c
index 025e136f3881,e65ff3171102..e9f60d311436
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@@ -847,58 -817,16 +847,65 @@@ static void timekeeping_adjust(s64 offs
  			offset = -offset;
  		} else
  			adj = timekeeping_bigadjust(error, &interval, &offset);
 -	} else
 +	} else /* No adjustment needed */
  		return;
  
+ 	WARN_ONCE(timekeeper.clock->maxadj &&
+ 			(timekeeper.mult + adj > timekeeper.clock->mult +
+ 						timekeeper.clock->maxadj),
+ 			"Adjusting %s more then 11%% (%ld vs %ld)\n",
+ 			timekeeper.clock->name, (long)timekeeper.mult + adj,
+ 			(long)timekeeper.clock->mult +
+ 				timekeeper.clock->maxadj);
 +	/*
 +	 * So the following can be confusing.
 +	 *
 +	 * To keep things simple, lets assume adj == 1 for now.
 +	 *
 +	 * When adj != 1, remember that the interval and offset values
 +	 * have been appropriately scaled so the math is the same.
 +	 *
 +	 * The basic idea here is that we're increasing the multiplier
 +	 * by one, this causes the xtime_interval to be incremented by
 +	 * one cycle_interval. This is because:
 +	 *	xtime_interval = cycle_interval * mult
 +	 * So if mult is being incremented by one:
 +	 *	xtime_interval = cycle_interval * (mult + 1)
 +	 * Its the same as:
 +	 *	xtime_interval = (cycle_interval * mult) + cycle_interval
 +	 * Which can be shortened to:
 +	 *	xtime_interval += cycle_interval
 +	 *
 +	 * So offset stores the non-accumulated cycles. Thus the current
 +	 * time (in shifted nanoseconds) is:
 +	 *	now = (offset * adj) + xtime_nsec
 +	 * Now, even though we're adjusting the clock frequency, we have
 +	 * to keep time consistent. In other words, we can't jump back
 +	 * in time, and we also want to avoid jumping forward in time.
 +	 *
 +	 * So given the same offset value, we need the time to be the same
 +	 * both before and after the freq adjustment.
 +	 *	now = (offset * adj_1) + xtime_nsec_1
 +	 *	now = (offset * adj_2) + xtime_nsec_2
 +	 * So:
 +	 *	(offset * adj_1) + xtime_nsec_1 =
 +	 *		(offset * adj_2) + xtime_nsec_2
 +	 * And we know:
 +	 *	adj_2 = adj_1 + 1
 +	 * So:
 +	 *	(offset * adj_1) + xtime_nsec_1 =
 +	 *		(offset * (adj_1+1)) + xtime_nsec_2
 +	 *	(offset * adj_1) + xtime_nsec_1 =
 +	 *		(offset * adj_1) + offset + xtime_nsec_2
 +	 * Canceling the sides:
 +	 *	xtime_nsec_1 = offset + xtime_nsec_2
 +	 * Which gives us:
 +	 *	xtime_nsec_2 = xtime_nsec_1 - offset
 +	 * Which simplfies to:
 +	 *	xtime_nsec -= offset
 +	 *
 +	 * XXX - TODO: Doc ntp_error calculation.
 +	 */
  	timekeeper.mult += adj;
  	timekeeper.xtime_interval += interval;
  	timekeeper.xtime_nsec -= offset;

commit 47724df3375bf0cf652039ab6b7ded29fe877de6
Merge: ee8f967b1517 abcefec31e3d
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Oct 18 08:31:07 2011 +0200

    Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core

commit ee8f967b15179c34b923c9b87c06984e682b24cf
Merge: 53b0a61a9d31 7bc7298d3f63
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Oct 17 21:43:43 2011 +0200

    Merge branch 'perf/core' of git://github.com/acmel/linux into perf/core

commit 53b0a61a9d31ef9b4256558c671094576e8eaf65
Merge: c73a3cb356f9 436fc280261d
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Oct 17 20:53:25 2011 +0200

    Merge branch 'tip/perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core

commit c73a3cb356f94b443aa7624b539493191dbf44c1
Merge: 910e94dd0cc5 6c3c5b26d085
Author: Ingo Molnar <mingo@elte.hu>
Date:   Sat Oct 15 16:57:48 2011 +0200

    Merge branch 'perf/core' of git://github.com/acmel/linux into perf/core

commit 910e94dd0cc5abacebf0bd5ffd859f61b9583857
Merge: 177e2163fe2a d696b58ca2c3
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 12 17:14:47 2011 +0200

    Merge branch 'tip/perf/core' of git://github.com/rostedt/linux into perf/core

commit 177e2163fe2a5951c1d0531baa4bc1f135c6b7b4
Merge: 7588badafcd7 44a56040a003
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Oct 12 09:07:49 2011 +0200

    Merge branch 'tip/perf/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core

commit 7588badafcd762034aa962ec86b82cacd4f42f74
Merge: d48b0e173715 64c6f0c7f8db
Author: Ingo Molnar <mingo@elte.hu>
Date:   Mon Oct 10 07:10:05 2011 +0200

    Merge branch 'perf/core' of git://github.com/acmel/linux into perf/core