linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cpu_relax() usage in raid6algos.c
@ 2010-09-10  1:55 Drew
  2010-09-10  2:49 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Drew @ 2010-09-10  1:55 UTC (permalink / raw)
  To: linux-raid

Hi,

I was going through the raid6 code in 2.6.35 and I came across an
empty function definition for cpu_relax() in include/linux/raid/pq.h
(line 135) that appears to be called in drivers/md/raid6algos.c (line
113). My C code skills are a bit rusty but I'm assuming the
cpu_relax() call in raid6algos.c uses the definition in pq.h.

If so, why is cpu_relax() in pq.h an empty function when there's
already a definition for cpu_relax() in
arch/x86/include/asm/processor.h?

Conversely, if the cpu_relax() function call in raid6algos.c uses the
definition in processor.h, why do we have a second definition in pq.h?

It strikes me that if the purpose of cpu_relax() is to signal the
kernel that we're not doing anything, why create our own empty
function when there's already one that is correct across all supported
architectures?

-- 
Drew

"Nothing in life is to be feared. It is only to be understood."
--Marie Curie

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

* Re: cpu_relax() usage in raid6algos.c
  2010-09-10  1:55 cpu_relax() usage in raid6algos.c Drew
@ 2010-09-10  2:49 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2010-09-10  2:49 UTC (permalink / raw)
  To: Drew; +Cc: linux-raid

On Thu, 9 Sep 2010 18:55:12 -0700
Drew <drew.kay@gmail.com> wrote:

> Hi,
> 
> I was going through the raid6 code in 2.6.35 and I came across an
> empty function definition for cpu_relax() in include/linux/raid/pq.h
> (line 135) that appears to be called in drivers/md/raid6algos.c (line
> 113). My C code skills are a bit rusty but I'm assuming the
> cpu_relax() call in raid6algos.c uses the definition in pq.h.
> 
> If so, why is cpu_relax() in pq.h an empty function when there's
> already a definition for cpu_relax() in
> arch/x86/include/asm/processor.h?
> 
> Conversely, if the cpu_relax() function call in raid6algos.c uses the
> definition in processor.h, why do we have a second definition in pq.h?
> 
> It strikes me that if the purpose of cpu_relax() is to signal the
> kernel that we're not doing anything, why create our own empty
> function when there's already one that is correct across all supported
> architectures?
> 


That is inside 
#ifndef __KERNEL__
#endif

and so is not used when compiling the kernel.  It is used when compiling the
same code into a user-space test program.

Thanks for the review though.

NeilBrown

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

end of thread, other threads:[~2010-09-10  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-10  1:55 cpu_relax() usage in raid6algos.c Drew
2010-09-10  2:49 ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).