[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFz6vpv01OAGcq9n8Q4bVgihqSiwz2qwNjBAHeFFvUD5Hg@mail.gmail.com>
Date: Thu, 15 Dec 2011 14:34:32 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Eric Paris <eparis@...hat.com>
Cc: Lino Sanfilippo <LinoSanfilippo@....de>,
Miklos Szeredi <miklos@...redi.hu>,
Al Viro <viro@...iv.linux.org.uk>, akpm@...ux-foundation.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH resend] audit: fix mark refcounting
On Thu, Dec 15, 2011 at 2:28 PM, Eric Paris <eparis@...hat.com> wrote:
>
> How expensive is an atomic_inc()/atomic_dec() combo? If it's mostly
> 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 cost.
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists