From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: "'Nick Piggin'" <nickpiggin@yahoo.com.au>,
"Andrew Morton" <akpm@osdl.org>
Cc: "Daniel Walker" <dwalker@mvista.com>,
<linux-kernel@vger.kernel.org>, <hzhong@gmail.com>
Subject: RE: [PATCH] Profile likely/unlikely macros
Date: Tue, 25 Apr 2006 16:14:01 -0700 [thread overview]
Message-ID: <4t16i2$qee02@orsmga001.jf.intel.com> (raw)
In-Reply-To: <444DF5B4.6030004@yahoo.com.au>
Nick Piggin wrote on Tuesday, April 25, 2006 3:11 AM
> Andrew Morton wrote:
> > Daniel Walker <dwalker@mvista.com> wrote:
> >
> >> + if (likeliness->type & LIKELY_UNSEEN) {
> >> + if (atomic_dec_and_test(&likely_lock)) {
> >> + if (likeliness->type & LIKELY_UNSEEN) {
> >> + likeliness->type &= (~LIKELY_UNSEEN);
> >> + likeliness->next = likeliness_head;
> >> + likeliness_head = likeliness;
> >> + }
> >> + }
> >> + atomic_inc(&likely_lock);
> >
> >
> > hm, good enough I guess. It does need a comment explaining why we
> > don't just do spin_lock().
>
> I guess it is so it can be used in NMIs and interrupts without turning
> interrupts off (so is somewhat lightweight).
>
> But please Daniel, just use spinlocks and trylock. This is buggy because
> it doesn't get the required release consistency correct.
It looks to me that there is really no need to construct a linked list for
"unseen" likely/unlikely usage. The information is already in the struct
"likeliness". do_check_likely always increment one of the counter, so if
both count values are zero, you know it is "unseen" and can be skipped while
printing the profile. So you can get rid of all that code by beefing up
seq_next().
- Ken
next prev parent reply other threads:[~2006-04-25 23:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-25 2:57 [PATCH] Profile likely/unlikely macros Daniel Walker
2006-04-25 3:06 ` Andrew Morton
2006-04-25 3:17 ` Daniel Walker
2006-04-25 10:11 ` Nick Piggin
2006-04-25 18:06 ` Hua Zhong
2006-04-25 18:23 ` Daniel Walker
2006-04-26 1:08 ` Nick Piggin
2006-04-26 9:56 ` Jörn Engel
2006-04-26 10:07 ` Nick Piggin
2006-04-25 23:14 ` Chen, Kenneth W [this message]
2006-04-25 9:19 ` Andreas Mohr
2006-05-01 22:05 ` Roland Dreier
-- strict thread matches above, loose matches on Subject: below --
2006-04-25 9:15 Mikael Pettersson
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='4t16i2$qee02@orsmga001.jf.intel.com' \
--to=kenneth.w.chen@intel.com \
--cc=akpm@osdl.org \
--cc=dwalker@mvista.com \
--cc=hzhong@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
/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