lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120228080647.GC21106@elte.hu>
Date:	Tue, 28 Feb 2012 09:06:47 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	John Stultz <john.stultz@...aro.org>
Cc:	lkml <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Eric Dumazet <eric.dumazet@...il.com>,
	Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH 1/7] time: Condense timekeeper.xtime into xtime_sec


* John Stultz <john.stultz@...aro.org> wrote:

> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -39,8 +39,11 @@ struct timekeeper {
>  	/* Raw nano seconds accumulated per NTP interval. */
>  	u32	raw_interval;
>  
> -	/* Clock shifted nano seconds remainder not stored in xtime.tv_nsec. */
> +	/* Current CLOCK_REALTIME time in seconds */
> +	u64	xtime_sec;
> +	/* Clock shifted nano seconds */
>  	u64	xtime_nsec;
> +
>  	/* Difference between accumulated time and NTP time in ntp
>  	 * shifted nano seconds. */
>  	s64	ntp_error;
> @@ -48,8 +51,6 @@ struct timekeeper {
>  	 * ntp shifted nano seconds. */
>  	int	ntp_error_shift;
>  
> -	/* The current time */
> -	struct timespec xtime;

Please use consistent vertical spacing for this structure.

> +static struct timespec timekeeper_xtime(struct timekeeper *tk)
> +{
> +	struct timespec ts;
> +
> +	ts.tv_sec = tk->xtime_sec;
> +	ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift);
> +	return ts;
> +}

btw., is tk->shift intentionally a signed int? If not then it 
would be better to make it u32, like tk->mult, to make sure the 
compiler never does complex signed arithmetics - and to clean up 
'struct timekeeper'.

> +
> +static void timekeeper_set_xtime(struct timekeeper *tk,
> +					const struct timespec *ts)

Pointless (because ugly) line break.

> +{
> +	tk->xtime_sec = ts->tv_sec;
> +	tk->xtime_nsec = ts->tv_nsec << tk->shift;
> +}
> +
> +
> +static void timekeeper_xtime_add(struct timekeeper *tk,
> +					const struct timespec *ts)

Pointless (because ugly) line break.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ