From: Linus Torvalds <torvalds@linux-foundation.org>
To: Eric Paris <eparis@redhat.com>
Cc: Lino Sanfilippo <LinoSanfilippo@gmx.de>,
Miklos Szeredi <miklos@szeredi.hu>,
Al Viro <viro@zeniv.linux.org.uk>,
akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH resend] audit: fix mark refcounting
Date: Thu, 15 Dec 2011 14:34:32 -0800 [thread overview]
Message-ID: <CA+55aFz6vpv01OAGcq9n8Q4bVgihqSiwz2qwNjBAHeFFvUD5Hg@mail.gmail.com> (raw)
In-Reply-To: <1323988092.22363.11.camel@localhost>
On Thu, Dec 15, 2011 at 2:28 PM, Eric Paris <eparis@redhat.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
next prev parent reply other threads:[~2011-12-15 22:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 14:59 [PATCH] audit: fix mark refcounting Miklos Szeredi
2011-11-15 14:12 ` Miklos Szeredi
2011-11-15 14:31 ` Eric Paris
2011-12-14 14:35 ` [PATCH resend] " Miklos Szeredi
2011-12-15 2:15 ` Linus Torvalds
2011-12-15 8:40 ` Al Viro
2011-12-15 8:56 ` Miklos Szeredi
2011-12-15 9:01 ` Al Viro
2011-12-15 9:03 ` Miklos Szeredi
2011-12-15 20:06 ` Lino Sanfilippo
2011-12-15 22:28 ` Eric Paris
2011-12-15 22:34 ` Linus Torvalds [this message]
2011-12-15 22:55 ` Al Viro
2012-01-12 16:59 ` Miklos Szeredi
2011-12-15 16:48 ` Linus Torvalds
2011-12-15 8:49 ` Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+55aFz6vpv01OAGcq9n8Q4bVgihqSiwz2qwNjBAHeFFvUD5Hg@mail.gmail.com \
--to=torvalds@linux-foundation.org \
--cc=LinoSanfilippo@gmx.de \
--cc=akpm@linux-foundation.org \
--cc=eparis@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).