From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Fitzhardinge Subject: Re: atomic counters larger than 24 bits? Date: Fri, 27 Mar 2009 11:15:29 -0700 Message-ID: <49CD17C1.4070504@goop.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer Cc: "Xen-Devel (E-mail)" List-Id: xen-devel@lists.xenproject.org Dan Magenheimer wrote: > In tmem, I have some counters that I need to keep coherent, > preferably without a lock, so I'm using atomic_inc/dec etc. > However the comments in include/asm-x86/atomic.h say repeatedly > that the "useful range of an atomic_t is only 24 bits". > Old sparcs had no way to implement proper atomics, so they used to reserve a byte in the atomic_t as a spinlock. But I don't think that's true any more; they have a separate lock hash, and atomics in the kernel are at least 32-bits. > First, are the comments true in the xen implementation? > (I don't see any code that restricts them to anything less > than "int".) If they ARE limited to 24 bits, what's the > recommended approach for larger atomic operations... or > do I just need to always use a lock? > I don't think the limitation ever applied to Xen. J