lkml.org 
[lkml]   [2006]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Profile likely/unlikely macros
On Mon, 24 Apr 2006 19:57:47 -0700, Daniel Walker 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);
>+ }

I'm pretty sure one can do this (prepending an element to a list)
w/o fiddling with locks by using CAS and looping until successful.

/Mikael
-
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-25 11:18    [W:0.088 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site