lkml.org 
[lkml]   [2006]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] Profile likely/unlikely macros
Date
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-26 01:16    [W:1.661 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site