Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Satyam Sharma <satyam@...>
Cc: Herbert Xu <herbert@...>, Christoph Lameter <clameter@...>, Paul E. McKenney <paulmck@...>, Stefan Richter <stefanr@...>, Chris Snook <csnook@...>, Linux Kernel Mailing List <linux-kernel@...>, <linux-arch@...>, Linus Torvalds <torvalds@...>, <netdev@...>, Andrew Morton <akpm@...>, <ak@...>, <heiko.carstens@...>, <davem@...>, <schwidefsky@...>, <wensong@...>, <horms@...>, <wjiang@...>, <cfriesen@...>, <zlynx@...>, <rpjday@...>, <jesper.juhl@...>, <segher@...>
Date: Thursday, August 16, 2007 - 12:11 am

Satyam Sharma writes:


The uses of atomic_read where one might want it to allow caching of
the result seem to me to fall into 3 categories:

1. Places that are buggy because of a race arising from the way it's
   used.

2. Places where there is a race but it doesn't matter because we're
   doing some clever trick.

3. Places where there is some locking in place that eliminates any
   potential race.

In case 1, adding volatile won't solve the race, of course, but it's
hard to argue that we shouldn't do something because it will slow down
buggy code.  Case 2 is hopefully pretty rare and accompanied by large
comment blocks, and in those cases caching the result of atomic_read
explicitly in a local variable would probably make the code clearer.
And in case 3 there is no reason to use atomic_t at all; we might as
well just use an int.

So I don't see any good reason to make the atomic API more complex by
having "volatile" and "non-volatile" versions of atomic_read.  It
should just have the "volatile" behaviour.

Paul.
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Tue Aug 14, 6:31 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 3:59 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Thu Aug 16, 4:50 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 6:34 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Thu Aug 16, 5:00 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 6:38 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Fri Aug 24, 1:15 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 8:26 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 8:42 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Wed Aug 15, 10:07 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Thu Aug 16, 3:39 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Paul Mackerras, (Thu Aug 16, 12:11 am)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Thu Aug 16, 2:54 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Thu Aug 16, 4:20 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 1:41 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Mon Sep 10, 2:59 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Mon Sep 10, 10:27 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Mon Sep 10, 5:36 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 7:17 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 8:04 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 10:15 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Sat Aug 18, 1:18 am)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 6:09 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Arjan van de Ven, (Mon Sep 10, 10:51 am)
Re: [PATCH] Document non-semantics of atomic_read() and atom..., Christoph Lameter, (Tue Sep 11, 3:35 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Mon Sep 10, 2:59 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Tue Aug 21, 10:59 am)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Mon Aug 20, 6:07 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Paul E. McKenney, (Thu Aug 16, 12:34 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Fri Aug 17, 6:14 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Paul E. McKenney, (Fri Aug 17, 10:31 am)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 10:15 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 10:17 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Paul E. McKenney, (Wed Aug 15, 10:35 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 8:59 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 9:41 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Paul E. McKenney, (Wed Aug 15, 10:32 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Wed Aug 15, 8:40 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Wed Aug 15, 2:31 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Wed Aug 15, 4:42 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Paul E. McKenney, (Wed Aug 15, 10:25 am)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Wed Aug 15, 4:58 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Segher Boessenkool, (Wed Aug 15, 5:07 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Paul E. McKenney, (Wed Aug 15, 12:08 pm)
Re: [PATCH 0/24] make atomic_read() behave consistently acro..., Christoph Lameter, (Tue Aug 14, 6:51 pm)