linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: prash_t@softhome.net
Cc: Robert Love <rml@tech9.net>, linux-kernel@vger.kernel.org
Subject: Re: Inconsistency in changing the state of task ??
Date: Thu, 6 Mar 2003 08:31:09 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.3.95.1030306081820.9822A-100000@chaos> (raw)
In-Reply-To: <courier.3E674902.000007D9@softhome.net>

On Thu, 6 Mar 2003 prash_t@softhome.net wrote:

> Thanks Robert for the reply.
> But I notice that __set_current_state() is same as current->state. So, I 
> didn't understand the safety factor on using __set_current_state( ). 
> 
> Also why should I use __set_current_state() instead of set_current_state() 
> when the later is SMP safe. 
> 
> Thanks in advance....
> Prashanth 
[SNIPPED...]

Usually, it would not make any difference. However, there is a
de facto standard to not use "__functions" or "__macros" directly
in code. Those are the things that the integrator will change to
accommodate different configurations, i.e., whether you are running
on a '386, '686, PPC or Sparc, SMP/High-memory, etc. So, you use
function() instead of _function() or __function().  If you use this
standard you might start out with this in some header:

#define function(p)  __function(p)

But in SMP machines, you might need some other code. Rather than
you having to modify your source, some header changes the definition
and it might become:

#define function(p) do{ MB(); __function(p); } while (0)

How, if you had executed __function() directly in your code,
you end up tossing that driver into the scrap-heap until it
gets fixed for SMP.


Bottom line; Look at the headers. If you have a choice, don't
use a function or macro that has leading underscores. If you
copy "working" drivers, you can be copying latent bugs. Don't
blindly go where others have gone (Star-Trek fans blink).


Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.



  reply	other threads:[~2003-03-06 13:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-04  8:36 Inconsistency in changing the state of task ?? prash_t
2003-03-04 17:51 ` Robert Love
2003-03-06 13:11   ` prash_t
2003-03-06 13:31     ` Richard B. Johnson [this message]
2003-03-06 20:05     ` Robert Love
2003-03-07  4:22 Perez-Gonzalez, Inaky

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=Pine.LNX.3.95.1030306081820.9822A-100000@chaos \
    --to=root@chaos.analogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prash_t@softhome.net \
    --cc=rml@tech9.net \
    /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).