lkml.org 
[lkml]   [1999]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: spin_unlock optimization(i386)
On Wed, 24 Nov 1999, Manfred Spraul wrote:

>What's the definition of a read memory barrier?

That's not the point. What you should tell me is that I can't reimplement
rmb() without a lock on the bus because the minium common divisor of a
spin_unlock() in pseudocode is not like in the Alpha implementation:

mb();
spinlock.lock = 0;

as I basically stated (I was thinking wrong) in my previous email.

On Alpha the spin_unlock can't be more finegrined because there's no way
you can _only_ avoid memory accesses before the barrier to be executed
after the barrier and letting accesses after the barrier to be executed
before the barrier.

I didn't understood well what IA32 enforces in a write: I thought the
write was enforcing order in both directions (up and down).

>---------
>AFAICS, the rmb() during set_current_state() is still required:

Not only the rmb() as it's common code (on i386 the rmb would be enough of
course). mb() is necessary instead.

BTW, In the example you provide below moving add_wait_queue in the middle
would remove the need of the barrier as an add_wait_queue executes both
the spin_lock and spin_unlock so it will sobstitute an mb() no matter how
the spin_lock/unlock are implemented.

>__wait_on_inode()
>add_wait_queue();
>current->state=TASK_UNINTERRUPTIBLE;
>if(inode->i_state & I_LOCK) {
> schedule();

Thanks.

Andrea


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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