lkml.org 
[lkml]   [2016]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 01/12] locking/atomic: Introduce inc/dec calls for FETCH-OP flavors
On Thu, 23 Jun 2016, Peter Zijlstra wrote:

>Would something like so make sense?
>
>---
>--- a/include/linux/atomic.h
>+++ b/include/linux/atomic.h
>@@ -188,15 +188,18 @@
> #endif
> #endif /* atomic_fetch_add_relaxed */
>
>-#ifndef atomic_fetch_inc
>-#define atomic_fetch_inc(v) (atomic_fetch_add(1, v))
>-#endif

Hmm perhaps I'm a bit lost in all this CPP maze, but where do you in fact
define atomic_fetch_inc() generically here? gcc cannot see it either.

Another option could be to add the above for atomic_fetch_inc inside the
ifndef atomic_fetch_release. Ie:

>-
> /* atomic_fetch_inc_relaxed */
> #ifndef atomic_fetch_inc_relaxed
>+
>+#ifndef atomic_fetch_inc

#define atomic_fetch_inc(v) (atomic_fetch_add(1, v))

>+#define atomic_fetch_inc_relaxed(v) atomic_fetch_add_relaxed(1, (v))
>+#define atomic_fetch_inc_acquire(v) atomic_fetch_add_acquire(1, (v))
>+#define atomic_fetch_inc_release(v) atomic_fetch_add_release(1, (v))

I was under the impression that if the archs don't define their own calls,
then we always default to fully ordered. Which is why I based all this ifdefery
on what is currently done with the other atomic_fetch_$ops.

>+#else /* atomic_fetch_inc */
> #define atomic_fetch_inc_relaxed atomic_fetch_inc
> #define atomic_fetch_inc_acquire atomic_fetch_inc
> #define atomic_fetch_inc_release atomic_fetch_inc
>+#endif /* atomic_fetch_inc */
>
> #else /* atomic_fetch_inc_relaxed */

Thanks,
Davidlohr

\
 
 \ /
  Last update: 2016-06-24 19:01    [W:0.625 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site