mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mikael Pettersson <mikpe@it.uu.se>
To: dwalker@mvista.com, linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, hzhong@gmail.com
Subject: Re: [PATCH] Profile likely/unlikely macros
Date: Tue, 25 Apr 2006 11:15:30 +0200 (MEST)	[thread overview]
Message-ID: <200604250915.k3P9FUbY029686@harpo.it.uu.se> (raw)

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

             reply	other threads:[~2006-04-25  9:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-25  9:15 Mikael Pettersson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-04-25  2:57 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
2006-04-25  9:19 ` Andreas Mohr
2006-05-01 22:05 ` Roland Dreier

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=200604250915.k3P9FUbY029686@harpo.it.uu.se \
    --to=mikpe@it.uu.se \
    --cc=akpm@osdl.org \
    --cc=dwalker@mvista.com \
    --cc=hzhong@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®