All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Pranith Kumar <pranith@gatech.edu>
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: regarding use of various cmpxchg* API
Date: Fri, 6 Jun 2014 09:29:24 +0200	[thread overview]
Message-ID: <20140606072924.GP6758@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <5390F2D5.909@gatech.edu>

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

On Thu, Jun 05, 2014 at 06:44:37PM -0400, Pranith Kumar wrote:
> Hi Peter, Ingo,
> 
> I see that in the drivers there are the following types of cmpxchg API:
> 
> __cmpxchg64()

That shouldn't really be used, and its only used in intel-iommu.c.

> atomic_cmpxchg()
> atomic64_cmpxchg()
> atomic_long_cmpxchg()

They're part of the atomic*_t family and should be used on their
respective types, no point in changing that.

> local_cmpxchg()(in kernel/events/ring_buffer.c)

This is part of the local_t API, also no real point to change that.

> this_cpu_cmpxchg()

This is part of the this_cpu*() family, and there's no way you can
generate the same code using the below to.

> cmpxchg()
> cmpxchg_local()

Which leaves these, which are used in all other cases.

> Since cmpxchg() internally handles the width, do you think it makes
> sense to replace the above uses of cmpxchg with the document API
> (cmpxchg, atomic_cmpxchg, cmpxchg_local)?
> 
> I am willing to do this and wanted to know if it something you think
> is worth pursuing.

Don't think that's useful. If you really want to go do something, try
the annotation I suggested to get the parisc/sparc32 things correct
again. Add the __atomic sparse address space and the store()/load()
accessors.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-06-06  7:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 22:44 regarding use of various cmpxchg* API Pranith Kumar
2014-06-06  7:29 ` Peter Zijlstra [this message]
2014-06-06 14:17   ` Pranith Kumar
2014-06-06 14:30     ` Peter Zijlstra

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=20140606072924.GP6758@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pranith@gatech.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.