[lkml]   [2001]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] move xchg/cmpxchg to atomic.h
   Date: 	Tue, 2 Jan 2001 00:11:57 -0800 (PST)
From: Grant Grundler <>

Fundemental problem is parisc only supports one atomic operation
(LDCW/LDCD) and uses spinlocks for all atomic operations including

Using spinlocks for the implementation of xchg on SMP might be

If you implement things like this, several subtle things might
break. For example, there is code in a few spots (or, at least at one
time there was) which assumed the update of the datum itself is atomic
and uses this assumption to do lock-free read-only accesses of the

If you require an external agent (f.e. your spinlock) because you
cannot implement xchg with a real atomic sequence, this breaks the
above assumptions.

It is very common to do things like:

elem->next = list->head;
xchg(&list->head, elem);

local_list = xchg(&list->head, NULL);
for_each(elem, local_list)

In fact we had code excatly like this in the buffer cache at one
point in time.

David S. Miller
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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