From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from www.tglx.de (www.tglx.de [62.245.132.106]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 27520DDFFF for ; Tue, 26 May 2009 22:04:56 +1000 (EST) Date: Tue, 26 May 2009 14:04:39 +0200 (CEST) From: Thomas Gleixner To: Stanislaw Gruszka Subject: Re: [PATCH resend4 2/3] itimers: fix periodic tics precision In-Reply-To: <20090526084455.672c652f@dhcp-lab-109.englab.brq.redhat.com> Message-ID: References: <20090522154339.06d30f0a@dhcp-lab-109.englab.brq.redhat.com> <20090525132814.442877e5@dhcp-lab-109.englab.brq.redhat.com> <20090525145132.03915e19@dhcp-lab-109.englab.brq.redhat.com> <20090526084455.672c652f@dhcp-lab-109.englab.brq.redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Peter Zijlstra , "linux-kernel@vger.kernel.org" , Oleg Nesterov , linuxppc-dev@ozlabs.org, Ingo Molnar , Andrew Morton List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue, 26 May 2009, Stanislaw Gruszka wrote: > On Mon, 25 May 2009 14:51:32 +0200 > Stanislaw Gruszka wrote: > > > On Mon, 25 May 2009 14:32:14 +0200 (CEST) > > Thomas Gleixner wrote: > > > > > On Mon, 25 May 2009, Stanislaw Gruszka wrote: > > > > @@ -904,6 +905,7 @@ void __init time_init(void) > > > > tb_ticks_per_usec = ppc_tb_freq / 1000000; > > > > tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); > > > > calc_cputime_factors(); > > > > + cputime_one = jiffies_to_cputime(1); > > > > > > 1) The variable name is misleading. > > > > What about cputime_one_jiffy ? > > > > > 2) The patch breaks all powerpc platforms which have > > > CONFIG_VIRT_CPU_ACCOUNTING=n and ia64 with > > > CONFIG_VIRT_CPU_ACCOUNTING=y > > > > Stupid me, in asm-generic/cputime.h should be > > #define cputime_one jiffies_to_cputime(1) > > Hmmm, I'm confused. Perhaps I missed something, but I think patch was ok. > For powerpc and ia64 and CONFIG_VIRT_CPU_ACCOUNTING=n definitions from > asm-generic/cputime.h where used. In this file was: > > #define cputime_one (1UL) In time_init you add unconditionally: > > > > @@ -904,6 +905,7 @@ void __init time_init(void) > > > > tb_ticks_per_usec = ppc_tb_freq / 1000000; > > > > tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); > > > > calc_cputime_factors(); > > > > + cputime_one = jiffies_to_cputime(1); I doubt that the compiler will happy about that as it expands to (1UL) = jiffies_to_cputime(1) or jiffies_to_cputime(1) = jiffies_to_cputime(1) in the CONFIG_VIRT_CPU_ACCOUTING=n case. > and that correct as jiffies_to_cputime(x) is just (x) > > For CONFIG_VIRT_CPU_ACCOUTING=y: > - For powerpc additional variable was declared and computed in > initialization time. Declaration of was in __KERENEL__ scope. > - For ia64: cputime_one was defined as jiffies_to_cputime(1) My bad, I missed the ia64 hunk. > Does we really need such optimization (because before usage of > jiffies_to_cputime(1) was just fine) ? Well, there is a subtle difference between working and nobody noticing the overhead. If we notice such heavy instructions in a code path we change then ignoring the optimization with the argument that it worked before is just plain wrong. Thanks, tglx