public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sys_time-speedup-small-cleanup
@ 2007-06-26 12:34 Oleg Nesterov
  2007-06-26 16:21 ` Chris Snook
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Nesterov @ 2007-06-26 12:34 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: John Stultz, Thomas Gleixner, Roman Zippel, Andrew Morton,
	linux-kernel

on top of sys_time-speedup.patch

Ingo Molnar wrote:
>
>  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 */

Why do we need this barrier? My guess it is needed to prevent
the reading of xtime.tv_sec twice, yes? In that case a simple
barrier() should be enough.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- t/kernel/time.c~	2007-06-26 16:28:59.000000000 +0400
+++ t/kernel/time.c	2007-06-26 16:32:09.000000000 +0400
@@ -64,7 +64,7 @@ asmlinkage long sys_time(time_t __user *
 	 */
 	time_t i = xtime.tv_sec;
 
-	smp_rmb(); /* sys_time() results are coherent */
+	barrier(); /* sys_time() results are coherent */
 
 	if (tloc) {
 		if (put_user(i, tloc))


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-27 19:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-26 12:34 [PATCH] sys_time-speedup-small-cleanup Oleg Nesterov
2007-06-26 16:21 ` Chris Snook
2007-06-27 11:29   ` Oleg Nesterov
2007-06-27 18:21     ` Chris Snook
2007-06-27 18:59       ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox