Messages in this thread | | | Date | Thu, 9 Sep 2004 07:54:20 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: [PATCH][5/8] Arch agnostic completely out of line locks / ppc64 |
| |
On Thu, 9 Sep 2004, Zwane Mwaikambo wrote: > > I think cpu_relax() (or some other primitive) should actually take a > parameter, this will allow for us to use monitor/mwait on i386 too so > that in cases where we're spinning waiting on memory modify we could do > something akin to the following; > > while (spin_is_locked(lock)) > cpu_relax(lock);
You can't do it that way. It needs to be arch-specific. When using something like monitor/mwait (or a "futex", which something like UML might use), you need to load the value you want to wait on _before_. So the interface literally would have to be the monitor/mwait interface:
for (;;) { lockval = monitor(lock); if (!is_locked(lockval)) break; mwait(lock, lockval); }
and the fact is, this is all much better just done in the arch-specific spinlock code.
Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |