rpms/kernel/F-7 kernel-2.6.spec, 1.3297, 1.3298 linux-2.6-sched-cfs.patch, 1.8, 1.9

Chuck Ebbert (cebbert) fedora-extras-commits at redhat.com
Fri Jul 27 14:46:34 UTC 2007


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13688

Modified Files:
	kernel-2.6.spec linux-2.6-sched-cfs.patch 
Log Message:
* Fri Jul 27 2007 Chuck Ebbert <cebbert at redhat.com>
- sync the CFS scheduler timekeeping changes with upstream



Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3297
retrieving revision 1.3298
diff -u -r1.3297 -r1.3298
--- kernel-2.6.spec	27 Jul 2007 14:39:39 -0000	1.3297
+++ kernel-2.6.spec	27 Jul 2007 14:46:01 -0000	1.3298
@@ -2293,6 +2293,9 @@
 %endif
 
 %changelog
+* Fri Jul 27 2007 Chuck Ebbert <cebbert at redhat.com>
+- sync the CFS scheduler timekeeping changes with upstream
+
 * Fri Jul 27 2007 David Woodhouse <dwmw2 at infradead.org>
 - Update PlayStation 3 support (#249217)
 

linux-2.6-sched-cfs.patch:

Index: linux-2.6-sched-cfs.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/linux-2.6-sched-cfs.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- linux-2.6-sched-cfs.patch	26 Jul 2007 21:56:04 -0000	1.8
+++ linux-2.6-sched-cfs.patch	27 Jul 2007 14:46:01 -0000	1.9
@@ -24,15 +24,21 @@
 
 [remove the original sys_time() speedup]
 
-4e44f3497d41db4c3b9051c61410dee8ae4fb49c
+[removed - upstream reverted]
 sys_time() speedup
 
-[not merged yet]
+[removed - never merged upstream]
 time: introduce xtime_seconds
 
-[not merged]
+[b47e8608a08766ef8121cd747d3aaf6c3dc22649]
 sched: increase SCHED_LOAD_SCALE_FUZZ
 
+[2c6b47de17c75d553de3e2fb426d8298d2074585]
+Cleanup non-arch xtime uses, use get_seconds() or current_kernel_time().
+
+[17c38b7490b3f0300c7812aefdae2ddda7ab4112]
+Cache xtime every call to update_wall_time
+
 Index: linux/Documentation/kernel-parameters.txt
 ===================================================================
 --- linux.orig/Documentation/kernel-parameters.txt
@@ -7675,118 +7681,6 @@
  		.ctl_name	= KERN_PANIC,
  		.procname	= "panic",
  		.data		= &panic_timeout,
-Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4e44f3497d41db4c3b9051c61410dee8ae4fb49c
-Commit:     4e44f3497d41db4c3b9051c61410dee8ae4fb49c
-Parent:     f482394ccbca7234d29cc146d4a2b94f976ce5a1
-Author:     Ingo Molnar <mingo at elte.hu>
-AuthorDate: Sun Jul 15 23:41:18 2007 -0700
-Committer:  Linus Torvalds <torvalds at woody.linux-foundation.org>
-CommitDate: Mon Jul 16 09:05:48 2007 -0700
-
-    sys_time() speedup
-    
-    Improve performance of sys_time().  sys_time() returns time in seconds, but
-    it does so by calling do_gettimeofday() and then returning the tv_sec
-    portion of the GTOD time.  But the data structure "xtime", which is updated
-    by every timer/scheduler tick, already offers HZ granularity time.
-    
-    The patch improves the sysbench OLTP macrobenchmark significantly:
-    
-    2.6.22-rc6:
-    
-    #threads
-       1:        transactions:                        3733   (373.21 per sec.)
-       2:        transactions:                        6676   (667.46 per sec.)
-       3:        transactions:                        6957   (695.50 per sec.)
-       4:        transactions:                        7055   (705.48 per sec.)
-       5:        transactions:                        6596   (659.33 per sec.)
-    
-    2.6.22-rc6 + sys_time.patch:
-    
-       1:        transactions:                        4005   (400.47 per sec.)
-       2:        transactions:                        7379   (737.77 per sec.)
-       3:        transactions:                        7347   (734.49 per sec.)
-       4:        transactions:                        7468   (746.65 per sec.)
-       5:        transactions:                        7428   (742.47 per sec.)
-    
-    Mixed API uses of gettimeofday() and time() are guaranteed to be coherent
-    via the use of a at-most-once-per-second slowpath that updates xtime.
-    
-    [akpm at linux-foundation.org: build fixes]
-    Signed-off-by: Ingo Molnar <mingo at elte.hu>
-    Cc: John Stultz <johnstul at us.ibm.com>
-    Cc: Thomas Gleixner <tglx at linutronix.de>
-    Cc: Roman Zippel <zippel at linux-m68k.org>
-    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
-    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
----
- kernel/time.c |   32 ++++++++++++++++++++++++--------
- 1 files changed, 24 insertions(+), 8 deletions(-)
-
-diff --git a/kernel/time.c b/kernel/time.c
-index f04791f..ffe1914 100644
---- a/kernel/time.c
-+++ b/kernel/time.c
-@@ -57,14 +57,17 @@ EXPORT_SYMBOL(sys_tz);
-  */
- asmlinkage long sys_time(time_t __user * tloc)
- {
--	time_t i;
--	struct timeval tv;
-+	/*
-+	 * We read xtime.tv_sec atomically - it's updated
-+	 * atomically by update_wall_time(), so no need to
-+	 * even read-lock the xtime seqlock:
-+	 */
-+	time_t i = xtime.tv_sec;
- 
--	do_gettimeofday(&tv);
--	i = tv.tv_sec;
-+	smp_rmb(); /* sys_time() results are coherent */
- 
- 	if (tloc) {
--		if (put_user(i,tloc))
-+		if (put_user(i, tloc))
- 			i = -EFAULT;
- 	}
- 	return i;
-@@ -373,12 +376,25 @@ void do_gettimeofday (struct timeval *tv)
- 
- 	tv->tv_sec = sec;
- 	tv->tv_usec = usec;
--}
- 
-+	/*
-+	 * Make sure xtime.tv_sec [returned by sys_time()] always
-+	 * follows the gettimeofday() result precisely. This
-+	 * condition is extremely unlikely, it can hit at most
-+	 * once per second:
-+	 */
-+	if (unlikely(xtime.tv_sec != tv->tv_sec)) {
-+		unsigned long flags;
-+
-+		write_seqlock_irqsave(&xtime_lock, flags);
-+		update_wall_time();
-+		write_sequnlock_irqrestore(&xtime_lock, flags);
-+	}
-+}
- EXPORT_SYMBOL(do_gettimeofday);
- 
-+#else	/* CONFIG_TIME_INTERPOLATION */
- 
--#else
- #ifndef CONFIG_GENERIC_TIME
- /*
-  * Simulate gettimeofday using do_gettimeofday which only allows a timeval
-@@ -394,7 +410,7 @@ void getnstimeofday(struct timespec *tv)
- }
- EXPORT_SYMBOL_GPL(getnstimeofday);
- #endif
--#endif
-+#endif	/* CONFIG_TIME_INTERPOLATION */
- 
- /* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
-  * Assumes input in normal date format, i.e. 1980-12-31 23:59:59
 Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4bd77321a833077c5c9ac7b9d284e261e4a8906e
 Commit:     4bd77321a833077c5c9ac7b9d284e261e4a8906e
 Parent:     45f384a64f0769bb9a3caf0516de88a629f48e61
@@ -7955,220 +7849,418 @@
  			cpu_clear(cpu_of(busiest), cpus);
  			if (!cpus_empty(cpus))
  				goto redo;
-Subject: time: introduce xtime_seconds
-From: Ingo Molnar <mingo at elte.hu>
-
-introduce the xtime_seconds optimization. This is a read-mostly 
-low-resolution time source available to sys_time() and kernel-internal 
-use. This variable is kept uptodate atomically, and it's monotically 
-increased, every time some time interface constructs an xtime-alike time 
-result that overflows the seconds value. (it's updated from the timer 
-interrupt as well)
-
-this way high-resolution time results update their seconds component at 
-the same time sys_time() does it:
-
- 1184858832999989000
- 1184858832000000000
- 1184858832999992000
- 1184858832000000000
- 1184858832999996000
- 1184858832000000000
- 1184858832999999000
- 1184858832000000000
- 1184858833000003000
- 1184858833000000000
- 1184858833000006000
- 1184858833000000000
- 1184858833000009000
- 1184858833000000000
-
- [ these are nsec time results from alternating calls to sys_time() and 
-   sys_gettimeofday(), recorded at the seconds boundary. ]
-
-instead of the previous (non-coherent) behavior:
-
- 1184848950999987000
- 1184848950000000000
- 1184848950999990000
- 1184848950000000000
- 1184848950999994000
- 1184848950000000000
- 1184848950999997000
- 1184848950000000000
- 1184848951000001000
- 1184848950000000000
- 1184848951000005000
- 1184848950000000000
- 1184848951000008000
- 1184848950000000000
- 1184848951000011000
- 1184848950000000000
- 1184848951000015000
+Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2c6b47de17c75d553de3e2fb426d8298d2074585
+Commit:     2c6b47de17c75d553de3e2fb426d8298d2074585
+Parent:     0de085bb474f64e4fdb2f1ff3268590792648c7b
+Author:     john stultz <johnstul at us.ibm.com>
+AuthorDate: Tue Jul 24 17:47:43 2007 -0700
+Committer:  Linus Torvalds <torvalds at woody.linux-foundation.org>
+CommitDate: Wed Jul 25 10:09:20 2007 -0700
 
-Signed-off-by: Ingo Molnar <mingo at elte.hu>
+    Cleanup non-arch xtime uses, use get_seconds() or current_kernel_time().
+    
+    This avoids use of the kernel-internal "xtime" variable directly outside
+    of the actual time-related functions.  Instead, use the helper functions
+    that we already have available to us.
+    
+    This doesn't actually change any behaviour, but this will allow us to
+    fix the fact that "xtime" isn't updated very often with CONFIG_NO_HZ
+    (because much of the realtime information is maintained as separate
+    offsets to 'xtime'), which has caused interfaces that use xtime directly
+    to get a time that is out of sync with the real-time clock by up to a
+    third of a second or so.
+    
+    Signed-off-by: John Stultz <johnstul at us.ibm.com>
+    Cc: Ingo Molnar <mingo at elte.hu>
+    Cc: Thomas Gleixner <tglx at linutronix.de>
+    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
 ---
- include/linux/time.h      |   13 +++++++++++--
- kernel/time.c             |   25 ++++++-------------------
- kernel/time/timekeeping.c |   28 ++++++++++++++++++++++++----
- 3 files changed, 41 insertions(+), 25 deletions(-)
+ drivers/rtc/class.c        |    5 +++--
+ drivers/s390/net/ctcmain.c |    6 +++---
+ drivers/s390/net/netiucv.c |    4 ++--
+ include/linux/time.h       |    2 +-
+ kernel/acct.c              |    2 +-
+ kernel/hrtimer.c           |    2 +-
+ kernel/time.c              |   16 ----------------
+ kernel/time/timekeeping.c  |   16 ++++++++++++++++
+ kernel/tsacct.c            |    2 +-
+ net/rxrpc/af_rxrpc.c       |    2 +-
+ net/rxrpc/ar-connection.c  |    4 ++--
+ net/rxrpc/ar-transport.c   |    4 ++--
+ net/rxrpc/rxkad.c          |    2 +-
+ 13 files changed, 34 insertions(+), 33 deletions(-)
 
-Index: linux/include/linux/time.h
-===================================================================
---- linux.orig/include/linux/time.h
-+++ linux/include/linux/time.h
-@@ -91,19 +91,28 @@ static inline struct timespec timespec_s
- extern struct timespec xtime;
- extern struct timespec wall_to_monotonic;
- extern seqlock_t xtime_lock __attribute__((weak));
-+extern unsigned long xtime_seconds;
+diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
+index 8b3cd31..10ab3b7 100644
+--- a/drivers/rtc/class.c
++++ b/drivers/rtc/class.c
+@@ -46,6 +46,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)
+ {
+ 	struct rtc_device	*rtc = to_rtc_device(dev);
+ 	struct rtc_time		tm;
++	struct timespec		ts = current_kernel_time();
+ 
+ 	if (strncmp(rtc->dev.bus_id,
+ 				CONFIG_RTC_HCTOSYS_DEVICE,
+@@ -57,8 +58,8 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg)
+ 
+ 	/* RTC precision is 1 second; adjust delta for avg 1/2 sec err */
+ 	set_normalized_timespec(&delta,
+-				xtime.tv_sec - oldtime,
+-				xtime.tv_nsec - (NSEC_PER_SEC >> 1));
++				ts.tv_sec - oldtime,
++				ts.tv_nsec - (NSEC_PER_SEC >> 1));
  
- extern unsigned long read_persistent_clock(void);
- void timekeeping_init(void);
- 
-+extern void __update_xtime_seconds(unsigned long new_xtime_seconds);
-+
-+static inline void update_xtime_seconds(unsigned long new_xtime_seconds)
-+{
-+	if (unlikely((long)(new_xtime_seconds - xtime_seconds) > 0))
-+		__update_xtime_seconds(new_xtime_seconds);
-+}
-+
- static inline unsigned long get_seconds(void)
- {
--	return xtime.tv_sec;
-+	return xtime_seconds;
+ 	return 0;
  }
- 
+diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
+index b20fd06..92e8a37 100644
+--- a/drivers/s390/net/ctcmain.c
++++ b/drivers/s390/net/ctcmain.c
+@@ -674,7 +674,7 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
+ 	int first = 1;
+ 	int i;
+ 	unsigned long duration;
+-	struct timespec done_stamp = xtime;
++	struct timespec done_stamp = current_kernel_time();
+ 
+ 	DBF_TEXT(trace, 4, __FUNCTION__);
+ 
+@@ -730,7 +730,7 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
+ 		spin_unlock(&ch->collect_lock);
+ 		ch->ccw[1].count = ch->trans_skb->len;
+ 		fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
+-		ch->prof.send_stamp = xtime;
++		ch->prof.send_stamp = current_kernel_time();
+ 		rc = ccw_device_start(ch->cdev, &ch->ccw[0],
+ 				      (unsigned long) ch, 0xff, 0);
+ 		ch->prof.doios_multi++;
+@@ -2281,7 +2281,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
+ 		fsm_newstate(ch->fsm, CH_STATE_TX);
+ 		fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
+ 		spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
+-		ch->prof.send_stamp = xtime;
++		ch->prof.send_stamp = current_kernel_time();
+ 		rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx],
+ 				      (unsigned long) ch, 0xff, 0);
+ 		spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
+diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
+index 3d28e1a..2688894 100644
+--- a/drivers/s390/net/netiucv.c
++++ b/drivers/s390/net/netiucv.c
+@@ -753,7 +753,7 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg)
+ 
+ 	header.next = 0;
+ 	memcpy(skb_put(conn->tx_buff, NETIUCV_HDRLEN), &header, NETIUCV_HDRLEN);
+-	conn->prof.send_stamp = xtime;
++	conn->prof.send_stamp = current_kernel_time();
+ 	txmsg.class = 0;
+ 	txmsg.tag = 0;
+ 	rc = iucv_message_send(conn->path, &txmsg, 0, 0,
+@@ -1185,7 +1185,7 @@ static int netiucv_transmit_skb(struct iucv_connection *conn,
+ 		memcpy(skb_put(nskb, NETIUCV_HDRLEN), &header,  NETIUCV_HDRLEN);
+ 
+ 		fsm_newstate(conn->fsm, CONN_STATE_TX);
+-		conn->prof.send_stamp = xtime;
++		conn->prof.send_stamp = current_kernel_time();
+ 
+ 		msg.tag = 1;
+ 		msg.class = 0;
+diff --git a/include/linux/time.h b/include/linux/time.h
+index e6aea51..71181df 100644
+--- a/include/linux/time.h
++++ b/include/linux/time.h
+@@ -107,7 +107,7 @@ static inline unsigned long get_seconds(void)
  struct timespec current_kernel_time(void);
  
  #define CURRENT_TIME		(current_kernel_time())
 -#define CURRENT_TIME_SEC	((struct timespec) { xtime.tv_sec, 0 })
-+#define CURRENT_TIME_SEC	((struct timespec) { xtime_seconds, 0 })
++#define CURRENT_TIME_SEC	((struct timespec) { get_seconds(), 0 })
  
  extern void do_gettimeofday(struct timeval *tv);
  extern int do_settimeofday(struct timespec *tv);
-Index: linux/kernel/time.c
-===================================================================
---- linux.orig/kernel/time.c
-+++ linux/kernel/time.c
-@@ -58,11 +58,10 @@ EXPORT_SYMBOL(sys_tz);
- asmlinkage long sys_time(time_t __user * tloc)
- {
- 	/*
--	 * We read xtime.tv_sec atomically - it's updated
--	 * atomically by update_wall_time(), so no need to
--	 * even read-lock the xtime seqlock:
-+	 * We read xtime_seconds atomically - it's updated
-+	 * atomically by update_xtime_seconds():
- 	 */
--	time_t i = xtime.tv_sec;
-+	time_t i = xtime_seconds;
- 
- 	smp_rmb(); /* sys_time() results are coherent */
- 
-@@ -226,11 +225,11 @@ inline struct timespec current_kernel_ti
- 
- 	do {
- 		seq = read_seqbegin(&xtime_lock);
--		
-+
- 		now = xtime;
+diff --git a/kernel/acct.c b/kernel/acct.c
+index 70d0d88..24f0f8b 100644
+--- a/kernel/acct.c
++++ b/kernel/acct.c
+@@ -468,7 +468,7 @@ static void do_acct_process(struct file *file)
+ 	}
+ #endif
+ 	do_div(elapsed, AHZ);
+-	ac.ac_btime = xtime.tv_sec - elapsed;
++	ac.ac_btime = get_seconds() - elapsed;
+ 	/* we really need to bite the bullet and change layout */
+ 	ac.ac_uid = current->uid;
+ 	ac.ac_gid = current->gid;
+diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
+index eb1ddeb..a7bb05e 100644
+--- a/kernel/hrtimer.c
++++ b/kernel/hrtimer.c
+@@ -144,7 +144,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
+ #ifdef CONFIG_NO_HZ
+ 		getnstimeofday(&xts);
+ #else
+-		xts = xtime;
++		xts = current_kernel_time();
+ #endif
+ 		tom = wall_to_monotonic;
  	} while (read_seqretry(&xtime_lock, seq));
- 
--	return now; 
-+	return now;
+diff --git a/kernel/time.c b/kernel/time.c
+index 5b81da0..2289a8d 100644
+--- a/kernel/time.c
++++ b/kernel/time.c
+@@ -215,22 +215,6 @@ asmlinkage long sys_adjtimex(struct timex __user *txc_p)
+ 	return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;
  }
  
- EXPORT_SYMBOL(current_kernel_time);
-@@ -377,19 +376,7 @@ void do_gettimeofday (struct timeval *tv
- 	tv->tv_sec = sec;
- 	tv->tv_usec = usec;
- 
--	/*
--	 * Make sure xtime.tv_sec [returned by sys_time()] always
--	 * follows the gettimeofday() result precisely. This
--	 * condition is extremely unlikely, it can hit at most
--	 * once per second:
--	 */
--	if (unlikely(xtime.tv_sec != tv->tv_sec)) {
--		unsigned long flags;
+-inline struct timespec current_kernel_time(void)
+-{
+-        struct timespec now;
+-        unsigned long seq;
 -
--		write_seqlock_irqsave(&xtime_lock, flags);
--		update_wall_time();
--		write_sequnlock_irqrestore(&xtime_lock, flags);
--	}
-+	update_xtime_seconds(sec);
+-	do {
+-		seq = read_seqbegin(&xtime_lock);
+-		
+-		now = xtime;
+-	} while (read_seqretry(&xtime_lock, seq));
+-
+-	return now; 
+-}
+-
+-EXPORT_SYMBOL(current_kernel_time);
+-
+ /**
+  * current_fs_time - Return FS time
+  * @sb: Superblock.
+diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
+index 88c8102..07a3f14 100644
+--- a/kernel/time/timekeeping.c
++++ b/kernel/time/timekeeping.c
+@@ -509,3 +509,19 @@ void monotonic_to_bootbased(struct timespec *ts)
+ 	change_clocksource();
+ 	update_vsyscall(&xtime, clock);
  }
- EXPORT_SYMBOL(do_gettimeofday);
++
++struct timespec current_kernel_time(void)
++{
++	struct timespec now;
++	unsigned long seq;
++
++	do {
++		seq = read_seqbegin(&xtime_lock);
++
++		now = xtime;
++	} while (read_seqretry(&xtime_lock, seq));
++
++	return now;
++}
++
++EXPORT_SYMBOL(current_kernel_time);
+diff --git a/kernel/tsacct.c b/kernel/tsacct.c
+index 658f638..c122131 100644
+--- a/kernel/tsacct.c
++++ b/kernel/tsacct.c
+@@ -39,7 +39,7 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
+ 	ac_etime = timespec_to_ns(&ts);
+ 	do_div(ac_etime, NSEC_PER_USEC);
+ 	stats->ac_etime = ac_etime;
+-	stats->ac_btime = xtime.tv_sec - ts.tv_sec;
++	stats->ac_btime = get_seconds() - ts.tv_sec;
+ 	if (thread_group_leader(tsk)) {
+ 		stats->ac_exitcode = tsk->exit_code;
+ 		if (tsk->flags & PF_FORKNOEXEC)
+diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
+index 16a68df..c58fa0d 100644
+--- a/net/rxrpc/af_rxrpc.c
++++ b/net/rxrpc/af_rxrpc.c
+@@ -787,7 +787,7 @@ static int __init af_rxrpc_init(void)
+ 
+ 	BUILD_BUG_ON(sizeof(struct rxrpc_skb_priv) > sizeof(dummy_skb->cb));
+ 
+-	rxrpc_epoch = htonl(xtime.tv_sec);
++	rxrpc_epoch = htonl(get_seconds());
+ 
+ 	ret = -ENOMEM;
+ 	rxrpc_call_jar = kmem_cache_create(
+diff --git a/net/rxrpc/ar-connection.c b/net/rxrpc/ar-connection.c
+index 482750e..372b244 100644
+--- a/net/rxrpc/ar-connection.c
++++ b/net/rxrpc/ar-connection.c
+@@ -791,7 +791,7 @@ void rxrpc_put_connection(struct rxrpc_connection *conn)
+ 
+ 	ASSERTCMP(atomic_read(&conn->usage), >, 0);
+ 
+-	conn->put_time = xtime.tv_sec;
++	conn->put_time = get_seconds();
+ 	if (atomic_dec_and_test(&conn->usage)) {
+ 		_debug("zombie");
+ 		rxrpc_queue_delayed_work(&rxrpc_connection_reap, 0);
+@@ -835,7 +835,7 @@ void rxrpc_connection_reaper(struct work_struct *work)
+ 
+ 	_enter("");
+ 
+-	now = xtime.tv_sec;
++	now = get_seconds();
+ 	earliest = ULONG_MAX;
+ 
+ 	write_lock_bh(&rxrpc_connection_lock);
+diff --git a/net/rxrpc/ar-transport.c b/net/rxrpc/ar-transport.c
+index d43d78f..bb282a6 100644
+--- a/net/rxrpc/ar-transport.c
++++ b/net/rxrpc/ar-transport.c
+@@ -183,7 +183,7 @@ void rxrpc_put_transport(struct rxrpc_transport *trans)
+ 
+ 	ASSERTCMP(atomic_read(&trans->usage), >, 0);
+ 
+-	trans->put_time = xtime.tv_sec;
++	trans->put_time = get_seconds();
+ 	if (unlikely(atomic_dec_and_test(&trans->usage)))
+ 		_debug("zombie");
+ 		/* let the reaper determine the timeout to avoid a race with
+@@ -219,7 +219,7 @@ static void rxrpc_transport_reaper(struct work_struct *work)
+ 
+ 	_enter("");
+ 
+-	now = xtime.tv_sec;
++	now = get_seconds();
+ 	earliest = ULONG_MAX;
+ 
+ 	/* extract all the transports that have been dead too long */
+diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
+index 5ec7051..ac3cabd 100644
+--- a/net/rxrpc/rxkad.c
++++ b/net/rxrpc/rxkad.c
+@@ -916,7 +916,7 @@ static int rxkad_decrypt_ticket(struct rxrpc_connection *conn,
+ 		issue = be32_to_cpu(stamp);
+ 	}
+ 	p += 4;
+-	now = xtime.tv_sec;
++	now = get_seconds();
+ 	_debug("KIV ISSUE: %lx [%lx]", issue, now);
+ 
+ 	/* check the ticket is in date */
+Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=17c38b7490b3f0300c7812aefdae2ddda7ab4112
+Commit:     17c38b7490b3f0300c7812aefdae2ddda7ab4112
+Parent:     2c6b47de17c75d553de3e2fb426d8298d2074585
+Author:     john stultz <johnstul at us.ibm.com>
+AuthorDate: Tue Jul 24 18:38:34 2007 -0700
+Committer:  Linus Torvalds <torvalds at woody.linux-foundation.org>
+CommitDate: Wed Jul 25 10:17:44 2007 -0700
+
+    Cache xtime every call to update_wall_time
+    
+    This avoids xtime lag seen with dynticks, because while 'xtime' itself
+    is still not updated often, we keep a 'xtime_cache' variable around that
+    contains the approximate real-time that _is_ updated each time we do a
+    'update_wall_time()', and is thus never off by more than one tick.
+    
+    IOW, this restores the original semantics for 'xtime' users, as long as
+    you use the proper abstraction functions (ie 'current_kernel_time()' or
+    'get_seconds()' depending on whether you want a timespec or just the
+    seconds field).
+    
+    [ Updated Patch.  As penance for my sins I've also yanked another #ifdef
+      that was added to avoid the xtime lag w/ hrtimers.  ]
+    
+    Signed-off-by: John Stultz <johnstul at us.ibm.com>
+    Cc: Ingo Molnar <mingo at elte.hu>
+    Cc: Thomas Gleixner <tglx at linutronix.de>
+    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ include/linux/time.h      |    6 +-----
+ kernel/hrtimer.c          |    4 ----
+ kernel/time/timekeeping.c |   26 +++++++++++++++++++++++---
+ 3 files changed, 24 insertions(+), 12 deletions(-)
+
+diff --git a/include/linux/time.h b/include/linux/time.h
+index 71181df..6a5f503 100644
+--- a/include/linux/time.h
++++ b/include/linux/time.h
+@@ -99,11 +99,7 @@ extern int update_persistent_clock(struct timespec now);
+ extern int no_sync_cmos_clock __read_mostly;
+ void timekeeping_init(void);
  
-Index: linux/kernel/time/timekeeping.c
-===================================================================
---- linux.orig/kernel/time/timekeeping.c
-+++ linux/kernel/time/timekeeping.c
-@@ -45,13 +45,27 @@ EXPORT_SYMBOL(xtime_lock);
-  * the usual normalization.
-  */
- struct timespec xtime __attribute__ ((aligned (16)));
--struct timespec wall_to_monotonic __attribute__ ((aligned (16)));
+-static inline unsigned long get_seconds(void)
+-{
+-	return xtime.tv_sec;
+-}
 -
++unsigned long get_seconds(void);
+ struct timespec current_kernel_time(void);
+ 
+ #define CURRENT_TIME		(current_kernel_time())
+diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
+index a7bb05e..c21ca6b 100644
+--- a/kernel/hrtimer.c
++++ b/kernel/hrtimer.c
+@@ -141,11 +141,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
+ 
+ 	do {
+ 		seq = read_seqbegin(&xtime_lock);
+-#ifdef CONFIG_NO_HZ
+-		getnstimeofday(&xts);
+-#else
+ 		xts = current_kernel_time();
+-#endif
+ 		tom = wall_to_monotonic;
+ 	} while (read_seqretry(&xtime_lock, seq));
+ 
+diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
+index 07a3f14..acc417b 100644
+--- a/kernel/time/timekeeping.c
++++ b/kernel/time/timekeeping.c
+@@ -47,6 +47,19 @@ EXPORT_SYMBOL(xtime_lock);
  EXPORT_SYMBOL(xtime);
  
-+struct timespec wall_to_monotonic __attribute__ ((aligned (16))) __read_mostly;
-+
-+unsigned long xtime_seconds __read_mostly;
-+EXPORT_SYMBOL(xtime_seconds);
-+
-+/* pointer to current clocksource: */
-+static struct clocksource *clock __read_mostly;
  
--static struct clocksource *clock; /* pointer to current clocksource */
-+/*
-+ * Called when either xtime or any xtime-alike result back to
-+ * user-space overflows the xtime_seconds field:
-+ */
-+void __update_xtime_seconds(unsigned long new_xtime_seconds)
++#ifdef CONFIG_NO_HZ
++static struct timespec xtime_cache __attribute__ ((aligned (16)));
++static inline void update_xtime_cache(u64 nsec)
 +{
-+	unsigned long old_xtime_seconds = xtime_seconds;
- 
-+	if ((long)(new_xtime_seconds - old_xtime_seconds) > 0)
-+		cmpxchg(&xtime_seconds, old_xtime_seconds, new_xtime_seconds);
++	xtime_cache = xtime;
++	timespec_add_ns(&xtime_cache, nsec);
 +}
++#else
++#define xtime_cache xtime
++/* We do *not* want to evaluate the argument for this case */
++#define update_xtime_cache(n) do { } while (0)
++#endif
++
+ static struct clocksource *clock; /* pointer to current clocksource */
  
- #ifdef CONFIG_GENERIC_TIME
- /**
-@@ -100,6 +113,8 @@ static inline void __get_realtime_clock_
- 	} while (read_seqretry(&xtime_lock, seq));
  
- 	timespec_add_ns(ts, nsecs);
+@@ -478,6 +490,8 @@ void update_wall_time(void)
+ 	xtime.tv_nsec = (s64)clock->xtime_nsec >> clock->shift;
+ 	clock->xtime_nsec -= (s64)xtime.tv_nsec << clock->shift;
+ 
++	update_xtime_cache(cyc2ns(clock, offset));
 +
-+	update_xtime_seconds(ts->tv_sec);
+ 	/* check to see if there is a new clocksource to use */
+ 	change_clocksource();
+ 	update_vsyscall(&xtime, clock);
+@@ -510,6 +524,13 @@ void monotonic_to_bootbased(struct timespec *ts)
+ 	ts->tv_sec += total_sleep_time;
  }
  
- /**
-@@ -256,6 +271,8 @@ void __init timekeeping_init(void)
- 	clock->cycle_last = clocksource_read(clock);
- 
- 	xtime.tv_sec = sec;
-+	update_xtime_seconds(sec);
++unsigned long get_seconds(void)
++{
++	return xtime_cache.tv_sec;
++}
++EXPORT_SYMBOL(get_seconds);
 +
- 	xtime.tv_nsec = 0;
- 	set_normalized_timespec(&wall_to_monotonic,
- 		-xtime.tv_sec, -xtime.tv_nsec);
-@@ -290,6 +307,8 @@ static int timekeeping_resume(struct sys
- 		unsigned long sleep_length = now - timekeeping_suspend_time;
- 
- 		xtime.tv_sec += sleep_length;
-+		update_xtime_seconds(xtime.tv_sec);
 +
- 		wall_to_monotonic.tv_sec -= sleep_length;
- 	}
- 	/* re-base the last cycle value */
-@@ -464,6 +483,7 @@ void update_wall_time(void)
- 			clock->xtime_nsec -= (u64)NSEC_PER_SEC << clock->shift;
- 			xtime.tv_sec++;
- 			second_overflow();
-+			update_xtime_seconds(xtime.tv_sec);
- 		}
+ struct timespec current_kernel_time(void)
+ {
+ 	struct timespec now;
+@@ -518,10 +539,9 @@ struct timespec current_kernel_time(void)
+ 	do {
+ 		seq = read_seqbegin(&xtime_lock);
  
- 		/* interpolator bits */
+-		now = xtime;
++		now = xtime_cache;
+ 	} while (read_seqretry(&xtime_lock, seq));
+ 
+ 	return now;
+ }
+-
+ EXPORT_SYMBOL(current_kernel_time);




More information about the fedora-extras-commits mailing list