[lkml]   [2002]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: [PATCH 2.5.52] Use __set_current_state() instead of current-> state = (take 1)
On Wed, 2002-12-18 at 20:53, Perez-Gonzalez, Inaky wrote:

> - any setting before a return should be barriered unless we
> return to a place[s] known to be harmless

Not sure.

> - any setting to TASK_RUNNING should be kind of safe

Yes, I agree. It may race, but with what?

> - exec.c:de_thread(),
> while (atomic_read(&oldsig->count) > count) {
> oldsig->group_exit_task = current;
> - current->state = TASK_UNINTERRUPTIBLE;
> + __set_current_state(TASK_UNINTERRUPTIBLE);
> spin_unlock_irq(&oldsig->siglock);
> Should be safe, as spin_unlock_irq() will do memory clobber
> on sti() [undependant from UP/SMP].

The memory clobber only acts as a compiler barrier and insures the
compiler does not reorder the statements from the order in the C code.

What we need is a memory barrier to ensure the processor does not
reorder statements. In other words, the processor can completely
rearrange loads and stores as they are issued to it, as long as it does
not break obvious data dependencies. On a weakly ordered processor,
sans memory barrier, there is no telling when and where a store will
actually reach memory. This is regardless of the order of the C code or
anything else.

That said, I do not know if the above example is a problem or not. On a
very quick glance, the only issue I saw is the one I pointed out
earlier, and you fixed it.

Robert Love

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:31    [W:0.059 / U:1.092 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site