linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Drew <drew.kay@gmail.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: cpu_relax() usage in raid6algos.c
Date: Fri, 10 Sep 2010 12:49:02 +1000	[thread overview]
Message-ID: <20100910124902.52751ec6@notabene> (raw)
In-Reply-To: <AANLkTim6qQyhh4S0mOYoh5XPp8Zu1dj5gm2BU4zi2UpE@mail.gmail.com>

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

      reply	other threads:[~2010-09-10  2:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-10  1:55 cpu_relax() usage in raid6algos.c Drew
2010-09-10  2:49 ` Neil Brown [this message]

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=20100910124902.52751ec6@notabene \
    --to=neilb@suse.de \
    --cc=drew.kay@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).