Thread (2 messages) 2 messages, 2 authors, 2010-09-10

Re: cpu_relax() usage in raid6algos.c

From: Neil Brown <hidden>
Date: 2010-09-10 02:49:02

On Thu, 9 Sep 2010 18:55:12 -0700
Drew [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help