linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mathieu.desnoyers@polymtl.ca (Mathieu Desnoyers)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] [RFC] arm: add half-word __xchg
Date: Thu, 18 Mar 2010 22:12:22 -0400	[thread overview]
Message-ID: <20100319021222.GA17388@Krystal> (raw)
In-Reply-To: <20100319014906.GC14108@shareable.org>

* Jamie Lokier (jamie at shareable.org) wrote:
> Mathieu Desnoyers wrote:
> > But.. thinking about it. It's bad to have a 2-byte xchg primitive that
> > only works on UP and breaks the build on SMP. We should instead
> > implement a workaround based on __cmpxchg4 to perform the 2-byte xchg().
> 
> This exposes why there should be __cmpxchg_bool() versions, which do
> not loop, preferably in the generic kernel API, because the workaround
> using __cmpxchg4 has to add yet another pointless loop nesting to all
> cmpxchg users.

The workaround I propose is to use __cmpxchg4 in a loop for 2-byte xchg()
fallback on arm; it is not related to cmpxchg() in any way. I don't
think one single use-case justifies the creation of a __cmpxchg_bool()
across all architectures.

Also, I've never seen where having a cmpxchg primitive returning a
boolean is more efficient than returning the value read, ever. If we
have to loop, then we can re-use the value that has been read by
cmpxchg, while the version returning a boolean would need a read to
re-read the next value.

So.. I am afraid I am probably missing your point entirely, because I
don't see how this can improve anything.

Thanks,

Mathieu

> 
> --- Jamie

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

  reply	other threads:[~2010-03-19  2:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 16:22 __xchg for sizes other than 32bit Imre Deak
2010-03-10 17:35 ` Russell King - ARM Linux
2010-03-10 20:02   ` [PATCH] ARM support single byte cmpxchg and cmpxchg_local on ARMv6 Mathieu Desnoyers
2010-03-10 20:30     ` Russell King - ARM Linux
2010-03-10 21:15       ` Mathieu Desnoyers
2010-03-10 23:16   ` __xchg for sizes other than 32bit Jamie Lokier
2010-03-18  9:29   ` [PATCH 1/1] [RFC] arm: add half-word __xchg Alexander Shishkin
2010-03-18 12:32     ` Mathieu Desnoyers
2010-03-18 12:37       ` Alexander Shishkin
2010-03-18 13:33       ` Alexander Shishkin
2010-03-18 13:50         ` Mathieu Desnoyers
2010-03-18 16:33           ` Imre Deak
2010-03-18 17:21             ` Mathieu Desnoyers
2010-03-18 19:00               ` Imre Deak
2010-03-18 19:30                 ` Mathieu Desnoyers
2010-03-19  1:49           ` Jamie Lokier
2010-03-19  2:12             ` Mathieu Desnoyers [this message]
2010-03-19  3:36               ` Jamie Lokier
2010-03-25 15:52           ` [PATCH 1/1] [RFCv2] " Alexander Shishkin
2010-03-25 16:42           ` Alexander Shishkin
2010-03-27 22:52             ` Russell King - ARM Linux
2010-03-28  0:14               ` Jamie Lokier
2010-03-28  0:18                 ` Russell King - ARM Linux
2010-03-28  1:00                 ` Mathieu Desnoyers
2010-03-28 14:39                   ` Jamie Lokier

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=20100319021222.GA17388@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).