Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1181414 > unrolled thread

Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions

Started byGeert Uytterhoeven <geert@linux-m68k.org>
First post2015-07-10 11:20 +0200
Last post2015-07-10 19:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions Geert Uytterhoeven <geert@linux-m68k.org> - 2015-07-10 11:20 +0200
    Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask  definitions Peter Zijlstra <peterz@infradead.org> - 2015-07-10 18:30 +0200
      Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask  definitions Chris Metcalf <cmetcalf@ezchip.com> - 2015-07-10 19:40 +0200

#1181414 — Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2015-07-10 11:20 +0200
SubjectRe: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions
Message-ID<pKCDo-44s-23@gated-at.bofh.it>
Hi Peter,

On Thu, Jul 9, 2015 at 7:29 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> --- a/include/linux/atomic.h
> +++ b/include/linux/atomic.h
> @@ -28,6 +28,23 @@ static inline int atomic_add_unless(atom
>  #define atomic_inc_not_zero(v)         atomic_add_unless((v), 1, 0)
>  #endif
>
> +#ifndef atomic_nand
> +static inline void atomic_nand(int i, atomic_t *v)
> +{
> +       atomic_and(~i, v);

That sounds like a misnomer...

Your NAND is "A & ~B", while my[*] NAND is "~(A & B)"?

[*] https://en.wikipedia.org/wiki/NAND_logic

What about atomic_clear()? (Is atomic_bic() too ARM-centric?)

> +}
> +#endif
> +
> +static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v)
> +{
> +       atomic_nand(mask, v);
> +}

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
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/

[toc] | [next] | [standalone]


#1181726 — Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions

FromPeter Zijlstra <peterz@infradead.org>
Date2015-07-10 18:30 +0200
SubjectRe: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions
Message-ID<pKJlv-8hr-3@gated-at.bofh.it>
In reply to#1181414
On Fri, Jul 10, 2015 at 02:42:56PM +0100, Russell King - ARM Linux wrote:
> The obvious question though is whether we have an established name for this
> operation elsewhere in the kernel, and whether we should have consistency.

Consistency is good.

> In include/linux, we already have (grepping for 'and_*not'):
> 
> include/linux/nodemask.h:#define nodes_andnot(dst, src1, src2) \
> include/linux/bitmap.h:extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
> include/linux/cpumask.h:static inline int cpumask_andnot(struct cpumask *dstp,
> 
> We also have:
> 
> include/linux/signal.h:#define _sig_andn(x,y)       ((x) & ~(y))
> 
> which seems to be the only instance of "andn" in include/.

How about I rename the _sig_andn one to _sig_andnot, and go with
atomic_andnot, to match the *mask functions.

--
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/

[toc] | [prev] | [next] | [standalone]


#1181800 — Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions

FromChris Metcalf <cmetcalf@ezchip.com>
Date2015-07-10 19:40 +0200
SubjectRe: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions
Message-ID<pKKrh-t8-51@gated-at.bofh.it>
In reply to#1181726
On 07/10/2015 12:27 PM, Peter Zijlstra wrote:
> On Fri, Jul 10, 2015 at 02:42:56PM +0100, Russell King - ARM Linux wrote:
>> The obvious question though is whether we have an established name for this
>> operation elsewhere in the kernel, and whether we should have consistency.
> Consistency is good.
>
>> In include/linux, we already have (grepping for 'and_*not'):
>>
>> include/linux/nodemask.h:#define nodes_andnot(dst, src1, src2) \
>> include/linux/bitmap.h:extern int __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
>> include/linux/cpumask.h:static inline int cpumask_andnot(struct cpumask *dstp,
>>
>> We also have:
>>
>> include/linux/signal.h:#define _sig_andn(x,y)       ((x) & ~(y))
>>
>> which seems to be the only instance of "andn" in include/.
> How about I rename the _sig_andn one to _sig_andnot, and go with
> atomic_andnot, to match the *mask functions.

I'll respin my patch to just tweak tilepro's "andn" to use
"andnot" as well while I'm at it, then.  Making "andnot" a stand-alone
patch would cause conflicts so it might as well go in with your change.

-- 
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com

--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web