mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael S. Zick" <lkml@morethan.org>
To: Jon Masters <jonathan@jonmasters.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Dave Jones <davej@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: fishy code in arch/x86/kernel/tsc.c:time_cpufreq_notifier()
Date: Mon, 1 Jun 2009 16:49:36 -0500	[thread overview]
Message-ID: <200906011649.38694.lkml@morethan.org> (raw)
In-Reply-To: <1243889818.31439.28.camel@localhost.localdomain>

On Mon June 1 2009, Jon Masters wrote:
> On Mon, 2009-06-01 at 12:39 -0400, Christoph Hellwig wrote:
> > On Mon, Jun 01, 2009 at 12:29:55PM -0400, Dave Jones wrote:
> > > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
> > > index d57de05..78c54ea 100644
> > > --- a/arch/x86/kernel/tsc.c
> > > +++ b/arch/x86/kernel/tsc.c
> > > @@ -631,17 +631,15 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
> > >  				void *data)
> > >  {
> > >  	struct cpufreq_freqs *freq = data;
> > > -	unsigned long *lpj, dummy;
> > > +	unsigned long *lpj;
> > >  
> > >  	if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC))
> > >  		return 0;
> > >  
> > > -	lpj = &dummy;
> > > -	if (!(freq->flags & CPUFREQ_CONST_LOOPS))
> > > +	lpj = &boot_cpu_data.loops_per_jiffy;
> > >  #ifdef CONFIG_SMP
> > > +	if (!(freq->flags & CPUFREQ_CONST_LOOPS))
> > >  		lpj = &cpu_data(freq->cpu).loops_per_jiffy;
> > > -#else
> > > -	lpj = &boot_cpu_data.loops_per_jiffy;
> > >  #endif
> > 
> > This makes the code look a lot more sane and should fix the potential
> > issue.
> 
> Tiny niggle that you wind up setting lpj (loops per jiffy) twice if
> you're on SMP and have CPUFREQ_CONST_LOOPS.
> 

At least it is consistent. ;)
You set lpj twice if your not on SMP and have CPUFREG_CONST_LOOPS.

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



  reply	other threads:[~2009-06-01 21:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01 14:21 Christoph Hellwig
2009-06-01 16:29 ` Dave Jones
2009-06-01 16:39   ` Christoph Hellwig
2009-06-01 20:56     ` Jon Masters
2009-06-01 21:49       ` Michael S. Zick [this message]
2009-06-01 21:50         ` Michael S. Zick
2009-06-01 22:54 ` Daniel Barkalow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200906011649.38694.lkml@morethan.org \
    --to=lkml@morethan.org \
    --cc=davej@redhat.com \
    --cc=hch@infradead.org \
    --cc=jonathan@jonmasters.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®