From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH resend] audit: fix mark refcounting Date: Thu, 15 Dec 2011 14:34:32 -0800 Message-ID: References: <87obwof06x.fsf@tucsk.pomaz.szeredi.hu> <87ipljcjc2.fsf@tucsk.pomaz.szeredi.hu> <20111215084050.GQ2203@ZenIV.linux.org.uk> <87fwgmjjr9.fsf@tucsk.pomaz.szeredi.hu> <87aa6ujjf6.fsf@tucsk.pomaz.szeredi.hu> <20111215200631.GA2379@Neptun> <1323988092.22363.11.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Lino Sanfilippo , Miklos Szeredi , Al Viro , akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Eric Paris Return-path: In-Reply-To: <1323988092.22363.11.camel@localhost> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu, Dec 15, 2011 at 2:28 PM, Eric Paris wrote: > > How expensive is an atomic_inc()/atomic_dec() combo? =A0If it's mostl= y > free we can do it in the right place. It's pretty expensive, but it depends a lot on cache details etc. It involves a memory barrier on x86 too, and depending on architecture it might be anything from 150 cycles (P4 - but by now probably nobody cares) to "a few tens" of cycles (roughly 10-35 on modern x86). The cache miss itself - if it happens - is not counted in the above cos= t. A totally uncontended spinlock is actually cheaper than a pair of atomic ops. So if it's a hot path it probably should be moved elsewhere if possible. Linus