From: Felipe W Damasio <felipewd@terra.com.br>
To: kernel-janitors@vger.kernel.org
Subject: Re: [Kernel-janitors] Re: set_current_state
Date: Wed, 30 Jun 2004 12:58:05 +0000 [thread overview]
Message-ID: <40E2B8DD.4000504@terra.com.br> (raw)
In-Reply-To: <20040627223356.GA1653@masina>
[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]
Anupam Kapoor wrote:
> can you please elaborate what you mean here, i don't understand the
> connotations sorry !
There's the classic example that rml used when he wrote a few
explanation notes of when set_current_state should be used.
If we're setting the current task to TASK_* (other than RUNNING) and
after that, manipulating some variable:
current->state = TASK_INTERRUPTIBLE;
if (doritos)
{
...
}
And on some of other code path we're checking to see if we're in
TASK_INTERRUPTIBLE to also use the same variable:
if (current->state == TASK_INTERRUPTIBLE)
{
do-something-to-doritos;
}
Then, in this case, we need a memory barrier the guarantee that the
doritos variable will have the state set correctly _before_ manipulating it.
But again, state setting that are still open coded are not that simple
to see if we need set_current_state.
Most places it's not the end of the world to have an useless memory
barrier, but if we could things right and save an useless
instruction..it'd be better.
In short: If in doubt, always use set_current_state. :-)
Cheers,
Felipe
--
It's most certainly GNU/Linux, not Linux. Read more at
http://www.gnu.org/gnu/why-gnu-linux.html
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
prev parent reply other threads:[~2004-06-30 12:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-27 22:33 [Kernel-janitors] Re: set_current_state Domen Puncer
2004-06-28 13:33 ` Anupam Kapoor
2004-06-28 14:33 ` Domen Puncer
2004-06-30 11:09 ` Anupam Kapoor
2004-06-30 12:30 ` Felipe W Damasio
2004-06-30 12:56 ` Anupam Kapoor
2004-06-30 12:58 ` Felipe W Damasio [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=40E2B8DD.4000504@terra.com.br \
--to=felipewd@terra.com.br \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.