lkml.org 
[lkml]   [1999]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch] new spinlock variant, spinlock-2.3.30-A4
Date
Tuesday, November 30, 1999 6:36 PM
Ingo Molnar <mingo@chiara.csoma.elte.hu> wrote :

> movb $1, 3(%%esi) # spin_lock
> movl 4(%%esi), %%edx
> addl (%%esi), %%edx
> cmpl $0x01000000, %%edx
> je slow_path

This can lead to some dead loops, due to the fact that an atomic ( locked )
test and set is not used.
The lock acquire is based on the assumption that only one CPU execute the
lock code.
In theory if there are more than one CPUs executing the code, they can spend
a lot of loops without
getting the N bytes at zero.
This probability is higher greater is the number of CPUs.
Using a test and set instruction, even if N CPUs execute the same code at
the same time, only one gets
the lock value.

IMVHO,
Davide.

--
Debian, the freedom in freedom.


-
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.113 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site