From: prash_t@softhome.net
To: Robert Love <rml@tech9.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Inconsistency in changing the state of task ??
Date: Thu, 06 Mar 2003 06:11:30 -0700 [thread overview]
Message-ID: <courier.3E674902.000007D9@softhome.net> (raw)
In-Reply-To: <1046800283.999.59.camel@phantasy.awol.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( ).
Also why should I use __set_current_state() instead of set_current_state()
when the later is SMP safe.
Thanks in advance....
Prashanth
Robert Love writes:
> On Tue, 2003-03-04 at 03:36, prash_t@softhome.net wrote:
>
>> 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().
>
> You normally want to use set_current_state(), which is a nice
> abstraction and safe for SMP.
>
> Sometimes it is safe to use __set_current_state(), which does not
> provide a memory barrier.
>
> The above open-coded line can be changed to
> __set_current_state(TASK_RUNNING).
>
> Robert Love
>
next prev parent reply other threads:[~2003-03-06 13:01 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 [this message]
2003-03-06 13:31 ` Richard B. Johnson
2003-03-06 20:05 ` Robert Love
-- strict thread matches above, loose matches on Subject: below --
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=courier.3E674902.000007D9@softhome.net \
--to=prash_t@softhome.net \
--cc=linux-kernel@vger.kernel.org \
--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