lkml.org 
[lkml]   [1998]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: test_and_set_bit() not atomic forever? [cli/sti in char/vt.c [patch]]
Hi Philip,

Philip Blundell wrote:
>
> >The SPARC bitops.h code is ...hummm... interesting. It reads (quoting):
> >
> >/* User mode bitops, defined here for convenience. Note: these are not
>
> Those are the user-mode versions, not used in the kernel. Look further down
> the file for the kernel implementations (the guts of which are in arch/sparc/
> lib/bitops.S).
>
> p.

Indeed, the SPARC Linux implementation defines a "user-mode" non-atomic
test_and_set_bit(). The convenience of this feature is questionable,
IMHO, but then again I could never afford a SPARC box :-)

Just another remark on the i386 implementation of test_and_set_bit().
The bit test and set opcode in the test_and_set_bit() function
definition is preceded by the LOCK_PREFIX expression defined a few lines
above as:

#ifdef __SMP__
#define LOCK_PREFIX "lock ; "
#else
#define LOCK_PREFIX ""
#endif

Some people build SMP kernels regardless of having a single or more
processors. With a single processor, the net effect of the extra
unneeded lock prefix is a double performance loss: 1) a memory cycle
loss to read each lock prefix 2) since locked instruction cycles are
noncacheable, this can result in the loss of _many_ clock cycles.

Regards,
------------------------
André Balsa
andrebalsa@altern.org

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

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