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>] [day] [month] [year] [list]
Message-ID: <20131119084006.GC1243@gmail.com>
Date:	Tue, 19 Nov 2013 09:40:06 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	akpm@...ux-foundation.org
Cc:	tglx@...utronix.de, hpa@...or.com, mingo@...e.hu,
	sboyd@...eaurora.org, rmk@....linux.org.uk, voice.shen@...el.com,
	linux-kernel@...r.kernel.org,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [patch 1/3] sched_clock: document 4Mhz vs 1Mhz decision


* akpm@...ux-foundation.org <akpm@...ux-foundation.org> wrote:

> From: Stephen Boyd <sboyd@...eaurora.org>
> Subject: sched_clock: document 4Mhz vs 1Mhz decision
> 
> Bo Shen sent a patch to change this to 1Mhz instead of 4Mhz but according
> to Russell King the use of 4Mhz was intentional.  Add a comment to this
> effect so that others don't try to change the code as well.
> 
> Signed-off-by: Stephen Boyd <sboyd@...eaurora.org>
> Cc: Bo Shen <voice.shen@...el.com>
> Cc: Russell King <rmk@....linux.org.uk>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
> 
>  kernel/time/sched_clock.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff -puN kernel/time/sched_clock.c~sched_clock-document-4mhz-vs-1mhz-decision kernel/time/sched_clock.c
> --- a/kernel/time/sched_clock.c~sched_clock-document-4mhz-vs-1mhz-decision
> +++ a/kernel/time/sched_clock.c
> @@ -132,6 +132,10 @@ void __init sched_clock_register(u64 (*r
>  	clocks_calc_mult_shift(&cd.mult, &cd.shift, rate, NSEC_PER_SEC, 3600);
>  
>  	r = rate;
> +	/*
> +	 * Use 4MHz instead of 1MHz so that things like 1.832Mhz show as
> +	 * 1832Khz
> +	 */
>  	if (r >= 4000000) {
>  		r /= 1000000;
>  		r_unit = 'M';

Instead of magic precision cutoff limits the better solution would be 
to simply display not just decimal part but also the first 3 digits of 
the fractional part:

          1.123  Hz
	990.134 kHz
	  1.832 MHz
	 12.314 GHz

etc. - then every number could be displayed in its natural unit 
without magic precision limits.

It would also be mostly self-documenting.

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