linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Inconsistency in changing the state of task ??
@ 2003-03-04  8:36 prash_t
  2003-03-04 17:51 ` Robert Love
  0 siblings, 1 reply; 6+ messages in thread
From: prash_t @ 2003-03-04  8:36 UTC (permalink / raw)
  To: linux-kernel

Hi,
     while browsing through fs/select.c file of 2.4.19, I came across two 
DIFFERENT ways of changing the state of the current task in do_select(): 

            set_current_state = TASK_INTERRUPTIBLE;
     AND    current->state = TASK_RUNNING; 

I am curious to know if the second line of code doesn't cause any problem in 
SMP systems.  I also see the same situation in do_poll(). 

Please cc to my id since I am not subscribed to the mailing list. 

Thanks
Prashanth

^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: Inconsistency in changing the state of task ??
@ 2003-03-07  4:22 Perez-Gonzalez, Inaky
  0 siblings, 0 replies; 6+ messages in thread
From: Perez-Gonzalez, Inaky @ 2003-03-07  4:22 UTC (permalink / raw)
  To: 'Robert Love', 'prash_t@softhome.net'
  Cc: 'linux-kernel@vger.kernel.org'

> > 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( ).
> 
> There is no safety with __set_current_state().  It is just an
> abstraction.
> 
> The safety comes from set_current_state(), which ensures memory
> ordering.
> 
> This is an issue not just on SMP, but on a weakly ordered processor like
> Alpha.
> 
> > Also why should I use __set_current_state() instead of
> set_current_state()
> > when the later is SMP safe.
> 
> You only use __set_current_state() if you know you do not need to ensure
> memory ordering constraints.

Man, I forgot how many times I have already posted the patch to fix this ...

Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own
(and my fault)



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

end of thread, other threads:[~2003-03-07  4:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2003-03-06 20:05     ` Robert Love
2003-03-07  4:22 Perez-Gonzalez, Inaky

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).